This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/21799] New: [4.1 regression] Spurious ambiguity with pointers to members
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 May 2005 16:34:33 -0000
- Subject: [Bug c++/21799] New: [4.1 regression] Spurious ambiguity with pointers to members
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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