================
@@ -374,6 +397,37 @@ static_assert(std::is_abstract_v<int&>);
 // expected-note@-1 {{because it is a reference type}} \
 // expected-note@-1 {{because it is not a struct or class type}}
 
+static_assert(!std::is_const<int>::value);
+
+static_assert(std::is_const<void()>::value);
+// expected-error-re@-1 {{static assertion failed due to requirement 
'std::{{.*}}is_const<void ()>::value'}} \
+// expected-note@-1 {{'void ()' is not const}} \
+// expected-note@-1 {{because it is a function type}}
----------------
Tsche wrote:

The second note you emit here ("because it is a function type") seems 
misleading to me. It's not `const` because.. well.. the thing you gave it isn't 
`const`.

In C++ there are [Abominable Function 
Types](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0172r0.html), 
which do occasionally pop up in generic programs. Here's some relevant 
standardese: https://eel.is/c++draft/dcl.fct#11

I would like to see a test for something along the lines of
```cpp
typedef int FIC(int) const;
static_assert(std::is_const<FIC>::value); //expected to fail
```
here. I believe this is supposed to return `false` because of 
https://eel.is/c++draft/basic.type.qualifier#1.sentence-3

Therefore, I suggest the note to be changed to something along the lines of 
"function types are always cv-unqualified" (although.. a bit more 
de-standardesed perhaps?).


https://github.com/llvm/llvm-project/pull/235587
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to