g++-4.3 rejects the following code: namespace n1 { struct foo{}; } namespace n2 { struct foo{}; } using namespace n1; using namespace n2; template <typename tp> int run(tp const & t) { return t.foo; } struct bar { int foo; }; int main() { bar b; run(b); } the error message is: bug.cpp: In function ‘int run(const tp&)’: bug.cpp:14: error: reference to ‘foo’ is ambiguous bug.cpp:6: error: candidates are: struct n2::foo bug.cpp:2: error: struct n1::foo g++-4.1 and g++-4.2 accept the code, though ...
*** Bug 35139 has been marked as a duplicate of this bug. ***
Confirmed.
Caused by my http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129836 This is during tentative parse, so I guess the errors should be suppressed.
This should get higher priority than P3...
This is worse than PR32384, so either we have a fix for it or we should revert the fix for PR32384 before 4.3.0.
cp_parser_class_name since PR20293 errors unconditionally even during tentative parse. Mark, is there a way to get a silent tentative parse of the optional nested name specifier plus typename? Or is trying to parse it tentatively as pseudo-dtor followed by parsing it as id-expression/member access if the former just never going to work?
Posted 3 alternative patches: http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00410.html http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00418.html http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00422.html
Subject: Bug 35138 Author: jakub Date: Wed Feb 13 22:30:43 2008 New Revision: 132298 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132298 Log: PR c++/35138 * parser.c (cp_parser_pseudo_destructor_name): If next tokens are not identifier :: ~, return before calling cp_parser_type_name. * g++.dg/template/member8.C: New test. Added: trunk/gcc/testsuite/g++.dg/template/member8.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
Fixed.