[Bug c++/110497] Wrong error on non-static data member referenced in concept definition
daniel-dev at hotmail dot de
gcc-bugzilla@gcc.gnu.org
Sun Jul 2 08:08:51 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110497
--- Comment #2 from Daniel <daniel-dev at hotmail dot de> ---
Just some observations:
There was a similar discussion in
https://stackoverflow.com/questions/75443227/static-assert-on-an-ill-formed-no-diagnostic-required-expression
Note that if we use anything else which leads to the ill-formed expression for
T::b itself, e.g. B&, B*, int - gcc compiles without errors:
struct B {
const bool b = true;
};
template <typename T>
concept C = T::b;
static_assert( !C<B*> );
static_assert( !C<B&> );
static_assert( !C<int> );
https://gcc.godbolt.org/z/9c6YW1vWe
I would expect (at least as a user) the same behaviour for static_assert(!C<B>)
too, in that case.
So gcc seems to consider T::b (with T=b) in this context as a well-formed
expression, but not a constant expression.
Looks strange.
More information about the Gcc-bugs
mailing list