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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |67491
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
It seems we're issuing a hard error during satisfaction here because
substitution failure didn't occur, and the substituted constraint is
non-constant which renders the program ill-formed as per
[temp.constr.atomic]/3:

> If substitution results in an invalid type or expression, the constraint is 
> not satisfied. Otherwise, the lvalue-to-rvalue conversion is performed if 
> necessary, and E shall be a constant expression of type bool.

One might argue substitution failure should occur for T::b with T=B, but this
seems to be permitted by [expr.prim.id.general]/3 since constraint-expressions
are unevaluated contexts.

Note that if we use B::b directly in the concept definition then Clang also
rejects the program due to non-constant satisfaction rule:

struct B { const bool b = true; };
template <typename T>
concept C = B::b;
static_assert( !C<B> );

error: substitution into constraint expression resulted in a non-constant
expression

So GCC might be correct to reject the original program.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues

Reply via email to