This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/68386] New: error: invalid initialization of reference of type 'void (&&)()' from expression of type 'void()'
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 17 Nov 2015 14:26:32 +0000
- Subject: [Bug c++/68386] New: error: invalid initialization of reference of type 'void (&&)()' from expression of type 'void()'
- Auto-submitted: auto-generated
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&&) { }
^