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

Ross Kirsling via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 19 11:09:26 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'}}
----------------
rkirsling wrote:

Right, at first I wondered if I needed to recapitulate all of these existing diagnostic messages somehow, just to ensure that it would all be `note`s against a single `error`. But it [appears](https://github.com/llvm/llvm-project/pull/144220/files#diff-9e681885bce5b9efd3dba53a469fb788e863d7d5f76c657232ea4c62a4147ab4) that `is_constructible` is also incurring a second `error` (via `InitializationSequence::Diagnose`).

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


More information about the cfe-commits mailing list