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

            Bug ID: 97406
           Summary: Truncated pointer-to-member type in concept
                    satisfaction error
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

struct X {
  void f() { }
};

template<typename T>
requires (sizeof(T)==1)
void f(T)
{ }

int main()
{
  f(&X::f);
}

Compiled with -std=c++20 this gives:

pfm.cc: In function ‘int main()’:
pfm.cc:12:10: error: use of function ‘void f(T) [with T = void (X::*)()]’ with
unsatisfied constraints
   12 |   f(&X::f);
      |          ^
pfm.cc:7:6: note: declared here
    7 | void f(T)
      |      ^
pfm.cc:7:6: note: constraints not satisfied
pfm.cc: In instantiation of ‘void f(T) [with T = void (X::*)()]’:
pfm.cc:12:10:   required from here
pfm.cc:7:6:   required by the constraints of ‘template<class T>  requires 
sizeof (T) == 1 void f(T)’
pfm.cc:6:20: note: the expression ‘sizeof (T) == 1 [with T = void (X::*]’
evaluated to ‘false’
    6 | requires (sizeof(T)==1)
      |          ~~~~~~~~~~^~~~


The error is correct, but notice the type in the last note is wrong.
It says [with T = void (X::*] but the type should be void (X::*)()

Reply via email to