[clang] [clang] adds explanation for why std::is_const is false (PR #235587)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 26 08:47:01 PDT 2026


================
@@ -162,12 +164,17 @@ static_assert(!(std::is_const<const ExampleTypes::T>()()), "message");
 static_assert(std::is_same<decltype(std::is_const<const ExampleTypes::T>()), int>::value, "message");
 // expected-error at -1{{static assertion failed due to requirement 'std::is_same<std::is_const<const int>, int>::value': message}}
 static_assert(std::is_const<decltype(ExampleTypes::T(3))>::value, "message");
-// expected-error at -1{{static assertion failed due to requirement 'std::is_const<int>::value': message}}
+// expected-error at -1{{static assertion failed due to requirement 'std::is_const<int>::value': message}} \
+// expected-note at -1{{'decltype(ExampleTypes::T(3))' (aka 'int') is not const}} \
+// expected-note at -1{{because it is not marked 'const'}}
----------------
zyn0217 wrote:

This looks verbose, something is not const is enough clear that we don't need to explain why it is not const, IMO.

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


More information about the cfe-commits mailing list