Commit 5844511408

LemonBoy <thatlemon@gmail.com>
2020-12-09 20:47:56
std: prevent instantiation of atomic.Int with non-integral types
1 parent ef7db97
Changed files (1)
lib
std
atomic
lib/std/atomic/int.zig
@@ -10,6 +10,9 @@ const testing = std.testing;
 
 /// Thread-safe, lock-free integer
 pub fn Int(comptime T: type) type {
+    if (!std.meta.trait.isIntegral(T))
+        @compileError("Expected integral type, got '" ++ @typeName(T) ++ "'");
+
     return extern struct {
         unprotected_value: T,