struct blah
{
template<class t>
blah(void(*)(t), t){}
};
void Func(int i) {}
void Func2(int& i) {}
void test()
{
int i = 3;
blah b(Func, i);
blah b2(Func2, i);
}
c3RydWN0IGJsYWgKewogICB0ZW1wbGF0ZTxjbGFzcyB0PgogICBibGFoKHZvaWQoKikodCksIHQpe30KfTsKCnZvaWQgRnVuYyhpbnQgaSkge30Kdm9pZCBGdW5jMihpbnQmIGkpIHt9Cgp2b2lkIHRlc3QoKQp7CiAgIGludCBpID0gMzsKICAgYmxhaCBiKEZ1bmMsIGkpOyAgIAogICBibGFoIGIyKEZ1bmMyLCBpKTsKfQo=
prog.cpp: In function ‘void test()’:
prog.cpp:14:20: error: no matching function for call to ‘blah::blah(void (&)(int&), int&)’
prog.cpp:14:20: note: candidates are:
prog.cpp:4:4: note: template<class t> blah::blah(void (*)(t), t)
prog.cpp:4:4: note: template argument deduction/substitution failed:
prog.cpp:14:20: note: deduced conflicting types for parameter ‘t’ (‘int&’ and ‘int’)
prog.cpp:1:8: note: constexpr blah::blah(const blah&)
prog.cpp:1:8: note: candidate expects 1 argument, 2 provided
prog.cpp:1:8: note: constexpr blah::blah(blah&&)
prog.cpp:1:8: note: candidate expects 1 argument, 2 provided