https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105351

--- Comment #2 from Gawain Bolton <gawain.bolton at free dot fr> ---
Yes I believe this is a bug and strangely enough clang also seems to have this
issue.

>From the draft C++20 standard concerning "simple requirements" (cf.
https://isocpp.org/files/papers/N4860.pdf page 109):

A simple-requirement asserts the validity of an expression. [Note: The
enclosing requires-expression will evaluate to false if substitution of
template arguments into the expression fails. The expression is an unevaluated
operand (7.2). — end note] [Example:
template<typename T> concept C =
requires (T a, T b) {
a + b; // C<T> is true if a + b is a valid expression
};
— end example]

Clearly T::attr2 is not a valid expression for struct T { int attr2; }

Reply via email to