[Bug c++/60608] Template argument problem
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Mar 21 12:29:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60608
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-03-21
Ever confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to volumedriverteam from comment #0)
> void
> myfun2(const int)
Top-level const is removed from function parameters, so this function is
equivalent to:
void myfun2(int);
And the instantiation wrapper<const int> is equivalent to:
template<> void wrapper<const int>(void (*)(int), int);
G++ gets confused trying to match const int to int somewhere.
f.cc: In function ‘void test()’:
f.cc:31:33: error: no matching function for call to ‘wrapper(void (&)(int),
const int&)’
wrapper<const int>(myfun2, b);
^
f.cc:31:33: note: candidate is:
f.cc:4:1: note: template<class ... Args> void wrapper(void (*)(Args ...), Args
...)
wrapper(void (*f)(Args...),
^
f.cc:4:1: note: template argument deduction/substitution failed:
f.cc:31:33: note: mismatched types ‘const int’ and ‘int’
wrapper<const int>(myfun2, b);
^
More information about the Gcc-bugs
mailing list