From 584451140843f8e1524f3cebf0ca3ab580685b3d Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Wed, 9 Dec 2020 20:47:56 +0100 Subject: [PATCH] std: prevent instantiation of atomic.Int with non-integral types --- lib/std/atomic/int.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/std/atomic/int.zig b/lib/std/atomic/int.zig index 155a340b0a..cdbf4ca81e 100644 --- a/lib/std/atomic/int.zig +++ b/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,