[clang] [clang] adds explanation for why std::is_const is false (PR #235587)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 2 16:51:29 PST 2026
================
@@ -473,6 +527,38 @@ namespace test_namespace {
// expected-note at -1 {{'int &' is not abstract}} \
// expected-note at -1 {{because it is a reference type}} \
// expected-note at -1 {{because it is not a struct or class type}}
+
+ static_assert(!is_const<int>::value);
+
+ static_assert(is_const<void()>::value);
+ // expected-error-re at -1 {{static assertion failed due to requirement '{{.*}}is_const<void ()>::value'}} \
+ // expected-note at -1 {{'void ()' is not const}} \
+ // expected-note at -1 {{because it is a function type}} \
+
+ static_assert(is_const_v<void ()>);
+ // expected-error at -1 {{static assertion failed due to requirement 'is_const_v<void ()>'}} \
+ // expected-note at -1 {{'void ()' is not const}} \
+ // expected-note at -1 {{because it is a function type}}
+
+ static_assert(is_const<int &>::value);
+ // expected-error-re at -1 {{static assertion failed due to requirement '{{.*}}is_const<int &>::value'}} \
+ // expected-note at -1 {{'int &' is not const}} \
+ // expected-note at -1 {{because it is a reference type}}
----------------
NomaTyx wrote:
fixed this and also the function message
https://github.com/llvm/llvm-project/pull/235587
More information about the cfe-commits
mailing list