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

            Bug ID: 88515
           Summary: [concepts] id-expression that names non-static data
                    member rejected in requires-expression
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Casey at Carter dot net
  Target Milestone: ---

Compiling this TU:

    template<class T> concept bool C = 
        requires { T::value; };

    struct S { int value; };
    static_assert(C<S>);

with "g++ -std=c++2a -fconcepts -c" produces:

    /home/casey/casey/Desktop/repro2.cpp:5:15: error: invalid use of non-static
data member ‘S::value’
        5 | static_assert(C<S>);
          |               ^~~~
    /home/casey/casey/Desktop/repro2.cpp:4:16: note: declared here
        4 | struct S { int value; };
          |                ^~~~~
    /home/casey/casey/Desktop/repro2.cpp:5:15: error: static assertion failed
        5 | static_assert(C<S>);
          |

when it should compile successfully since an id-expression that denotes a
non-static data member can appear in an unevaluated operand
([expr.prim.id]/2.3) and expressions appearing within a requirement-body are
unevaluated operands ([expr.prim.req]/2).

Reply via email to