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

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 19 11:00:54 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'}}
----------------
efriedma-quic wrote:

Unlike the other DiagnoseTypeTraitDetails diagnostics, this is an "error", not a "note".  I'm not sure that actually causes any serious issues right now, but it's a bit confusing, and could cause issues in the future.

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


More information about the cfe-commits mailing list