[Bug c++/21799] New: [4.1 regression] Spurious ambiguity with pointers to members
bangerth at dealii dot org
gcc-bugzilla@gcc.gnu.org
Sat May 28 16:35:00 GMT 2005
This 4.1 regression is going to break one of the proposed benchmarks in
spec2005. I believe that we have established that this code
-----------------------------
template <class T> void f (T &, void (T::*)() );
template <class T> void f (const T &, void (T::*)() const);
struct X {
void g() const;
};
const X *x;
int main () {
f (*x, &X::g);
}
--------------------------------
is valid because the pointer to the constant member &X::g can't match the
first template (it wants a non-const pointer-to-member). The code is accepted
by all previous gcc versions, but with present mainline I get this:
spec/src> c++ -c x.cc
x.cc: In function ‘int main()’:
x.cc:11: error: call of overloaded ‘f(const X&, void (X::*)()const)’ is
ambiguous
x.cc:1: note: candidates are: void f(T&, void (T::*)()) [with T = const X]
x.cc:2: note: void f(const T&, void (T::*)()const) [with T =
X]
Too bad...
W.
--
Summary: [4.1 regression] Spurious ambiguity with pointers to
members
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bangerth at dealii dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21799
More information about the Gcc-bugs
mailing list