This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/68386] New: error: invalid initialization of reference of type 'void (&&)()' from expression of type 'void()'


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&&) { }
                           ^

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]