[Bug c++/61507] New: GCC does not compile function with parameter pack.
congh at google dot com
gcc-bugzilla@gcc.gnu.org
Sat Jun 14 01:38:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61507
Bug ID: 61507
Summary: GCC does not compile function with parameter pack.
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: congh at google dot com
GCC fails to compile the following code:
struct A {
void foo(const int &);
void foo(float);
};
template <typename... Args>
void bar(void (A::*memfun)(Args...), Args... args);
void go(const int& i) {
bar<const int &>(&A::foo, i);
}
The error message is shown below:
t.C:10:30: error: no matching function for call to ‘bar(<unresolved overloaded
function type>, const int&)’
bar<const int &>(&A::foo, i);
^
t.C:7:6: note: candidate: template<class ... Args> void bar(void (A::*)(Args
...), Args ...)
void bar(void (A::*memfun)(Args...), Args... args);
^
t.C:7:6: note: template argument deduction/substitution failed:
t.C:10:30: note: inconsistent parameter pack deduction with ‘const int&’ and
‘int’
bar<const int &>(&A::foo, i);
As the type is explicitly specified, why GCC would like to "deduce" it?
More information about the Gcc-bugs
mailing list