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

            Bug ID: 66091
           Summary: [c++-concepts] Overloading of member operators based
                    on constraints rejected; regression from r211591
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tom at honermann dot net
  Target Milestone: ---

The following test case was accepted by r211591 of the c++-concepts branch, but
is rejected by r222769.  My interpretation of N4377 is that this test case
should be accepted.

$ cat t.cpp
template<typename T>
concept bool C1() {
    return requires() { typename T::type1; };
}
template<typename T>
concept bool C2() {
    return C1<T>()
        && requires() { typename T::type2; };
}
template<C1 T>
struct S {
    S& operator++()
        { return *this; }
    S& operator++()
        requires C2<T>()
        { return *this; }
};

# Compiling with r222769:
$ g++ -c -std=c++1z t.cpp 
t.cpp:14:8: error: ‘S<T>& S<T>::operator++()’ cannot be overloaded
     S& operator++()
        ^
t.cpp:12:8: error: with ‘S<T>& S<T>::operator++()’
     S& operator++()
        ^

Reply via email to