[clang] [Clang] Diagnose unsatisfied `std::is_assignable`. (PR #144836)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 24 08:02:08 PDT 2025


================
@@ -99,6 +127,14 @@ static_assert(std::is_trivially_copyable_v<int&>);
 // expected-note at -1 {{'int &' is not trivially copyable}} \
 // expected-note at -1 {{because it is a reference type}}
 
+static_assert(std::is_assignable<int&, int>::value);
+
+static_assert(std::is_assignable<int&, void>::value);
+// expected-error-re at -1 {{static assertion failed due to requirement 'std::{{.*}}is_assignable<int &, void>::value'}} \
+// expected-error at -1 {{assigning to 'int' from incompatible type 'void'}}
----------------
Sirraide wrote:

This is a good candidate for nesting; I’ll make a note of this one somewhere. For now I think it’s fine to just emit the error (I’m very busy this week unfortunately, but I’m planning to open a pr for it next week if nothing gets in the way).

https://github.com/llvm/llvm-project/pull/144836


More information about the cfe-commits mailing list