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

            Bug ID: 68386
           Summary: error: invalid initialization of reference of type
                    'void (&&)()' from expression of type 'void()'
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

template<typename F> void f(F&&) { }

struct A {
  static void mf() { }
};

int main()
{
  A a;
  f( &a.mf );   // OK
  f( a.mf );    // error
}


a.cc: In function 'int main()':
a.cc:11:11: error: invalid initialization of reference of type 'void (&&)()'
from expression of type 'void()'
   f( a.mf );    // error
           ^

a.cc:1:27: note: in passing argument 1 of 'void f(F&&) [with F = void()]'
 template<typename F> void f(F&&) { }
                           ^

Reply via email to