[Bug c++/59818] New: [4.9 regression] Bogus error: call of overloaded .... is ambiguous
ppluzhnikov at google dot com
gcc-bugzilla@gcc.gnu.org
Wed Jan 15 00:53:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59818
Bug ID: 59818
Summary: [4.9 regression] Bogus error: call of overloaded ....
is ambiguous
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ppluzhnikov at google dot com
This is caused by r197790 (fix for PR c++/23055).
Google ref: b/12471166
/// --- cut ---
template <class T>
struct Identity {
typedef T type;
};
struct Foo {
template <typename T>
Foo(T*, void (Identity<T>::type::*m)(void));
template <typename T>
Foo(const T*, void (Identity<T>::type::*m)(void) const);
};
struct Bar {
void Method(void) const;
};
void Bar::Method(void) const
{
Foo foo(this, &Bar::Method);
}
/// --- cut ---
Using g++ (GCC) 4.9.0 20140110 (experimental)
g++ -c t.cc
t.cc: In member function 'void Bar::Method() const':
t.cc:20:29: error: call of overloaded 'Foo(const Bar*, void (Bar::*)() const)'
is ambiguous
Foo foo(this, &Bar::Method);
^
t.cc:20:29: note: candidates are:
t.cc:11:3: note: Foo::Foo(const T*, void (Identity<T>::type::*)() const) [with
T = Bar; typename Identity<T>::type = Bar]
Foo(const T*, void (Identity<T>::type::*m)(void) const);
^
t.cc:8:3: note: Foo::Foo(T*, void (Identity<T>::type::*)()) [with T = const
Bar; typename Identity<T>::type = const Bar]
Foo(T*, void (Identity<T>::type::*m)(void));
^
Replacing 'Identity<T>::type' with 'T' makes the problem go away.
Source accepted by gcc-4.8 and Clang.
More information about the Gcc-bugs
mailing list