Original-Message-ID: <390CCA10.D2C4F1AE@roguewave.com> Date: Sun, 30 Apr 2000 18:04:32 -0600 Hi, I believe this should compile according to 3.4.3.1. It fails with g++ 2.95.2. The compiler has no problem if A is not a template or if the call is fully qualified (i.e., with N::A<int>::foo()). Thanks Martin $ cat test.cpp namespace N { template <class T> struct A { int foo () const; }; template <class T> struct B: A<T> { int foo () const; }; } int main () { return N::B<int>().A<int>::foo (); } $ g++ test.cpp test.cpp: In function `int main()': test.cpp:21: `struct N::B<int>' has no member named `A' test.cpp:21: parse error before `::' Release: 2.95.2
Responsible-Changed-From-To: unassigned->nathan Responsible-Changed-Why: patch in progress
State-Changed-From-To: analyzed->feedback State-Changed-Why: I don't think the code is well formed. [3.4.5]/1 is the paragraph of interest, I don't see how [3.4.3.1] applies. this is an id-expression (which might be a qualified-id or an unqualified-id) We need to lookup 'A' in the class of 'B<int>'. 'A' is not a member of 'A<int>', so lookup does not find anything. We then lookup 'A' in the context of the entire expression. Again, this does not find anything. We therefore interpret the '<' as a less than operator.
State-Changed-From-To: feedback->analyzed State-Changed-Why: I've got a reponse from John Spicer (The edg front end accepts this code). The standard as written is unclear about class name injection, and DR 176 documents the problem. As that is an accepted DR, we should implement it (sometime...)
From: Wolfgang Bangerth <bangerth@apex68.ticam.utexas.edu> To: gcc-gnats@gcc.gnu.org Cc: Subject: c++/189: parse error in qualified member name lookup Date: Thu, 14 Nov 2002 14:23:58 -0600 Re-confirmed with 3.3 CVS from 2002-11-10 and 3.2.1 pre from the same date.
Still happens on the mainline (20030615): [zhivago2:~/src/gccPRs] pinskia% gcc pr189.cc pr189.cc: In function `int main()': pr189.cc:19: error: 'struct N::B<int>' has no member named 'A' pr189.cc:19: error: expected primary-expression pr189.cc:19: error: expected `;' pr189.cc:19: error: expected primary-expression pr189.cc:19: error: expected `;'
Nathan, are you still working on this?
Created attachment 7758 [details] current diff This diff gets us most of the way. However, as this is not a regression, it is now queued until non-regression bug fixes can be applied
(In reply to comment #7) > This diff gets us most of the way. However, as this is not a regression, it is > now queued until non-regression bug fixes can be applied Your message was back in December and now it is September, 10 months later and it looks your patch has not been applied yet.
Any news on this? It has been over a year since the patch has been attached to this bug.
Here is a shorter test case. namespace N { template<class T> struct B { int m; }; struct C : B<int> { }; } void g() { N::C().B<int>::m; }
Still happens with a recent mainline snapshot.
Heh, wish I had noticed Nathan's patch before reimplementing it.
Fixed.
*** Bug 9937 has been marked as a duplicate of this bug. ***
*** Bug 13950 has been marked as a duplicate of this bug. ***
Subject: Bug 189 Author: jason Date: Tue Nov 17 05:58:03 2009 New Revision: 154235 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154235 Log: PR c++/189, c++/9937, c++/13950, DR 176 * g++.dg/tc1/dr176.C: Adjust. Modified: trunk/gcc/cp/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/tc1/dr176.C
*** Bug 13052 has been marked as a duplicate of this bug. ***
*** Bug 37350 has been marked as a duplicate of this bug. ***