[Bug c++/59885] New: compiler issues incorrect "ambiguous base class" error message
burrows.labs at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Jan 20 09:27:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59885
Bug ID: 59885
Summary: compiler issues incorrect "ambiguous base class" error
message
Product: gcc
Version: 4.7.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: burrows.labs at gmail dot com
The following code produces an error message that I believe to have swapped the
'base' and 'derived' class.
#include <iostream>
template <typename... Whatever>
class A;
template <typename Type>
class A<Type> {};
template <typename Type, typename Head, typename... Tail>
class A<Type, Head, Tail...> : A<Type, Tail...> {};
class B : public A<int, int, double> {};
template <typename Type, typename... Unused>
void f(A<Type, Unused...> *ref)
{
std::cout << "f.a" << std::endl;
}
int
main()
{
B *b = new B;
f(b);
return 0;
}
// eof
$ g++-4.7 -std=c++0x -pedantic -Wall in.cpp -o in
in.cpp: In function ‘int main()’:
in.cpp:24:8: error: no matching function for call to ‘f(B*&)’
in.cpp:24:8: note: candidate is:
in.cpp:15:6: note: template<class Type, class ... Unused> void f(A<Type, Unused
...>*)
in.cpp:15:6: note: template argument deduction/substitution failed:
in.cpp:24:8: note: ‘B’ is an ambiguous base class of ‘A<Type, Unused ...>’
More information about the Gcc-bugs
mailing list