This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/9665: error with member and member template of same name
- From: bangerth at dealii dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, yujie dot wu at hec dot utah dot edu
- Date: 14 Feb 2003 21:09:36 -0000
- Subject: Re: c++/9665: error with member and member template of same name
- Reply-to: bangerth at dealii dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, yujie dot wu at hec dot utah dot edu, gcc-gnats at gcc dot gnu dot org
Old Synopsis: g++ (GCC) 3.2.1 rejects obvious legal code
New Synopsis: error with member and member template of same name
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Fri Feb 14 21:09:36 2003
State-Changed-Why:
Confirmed. A simpler testcase is
---------------------
template <typename T> struct A {
void foo();
template <typename> void foo();
};
template <typename T>
void A<T>::foo() {}
------------------------
tmp/g> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc:7: error: expected 2 levels of template parms for `void A<T>::foo()', got 1
The problem goes away of course, if the member template
is removed. It also goes away if we change the order
of declaration (!) of the two versions of foo, which
already suggests the right patch: presently we walk the
list of member functions and stop at the first one with
name foo. We then note that the number of template
levels is incorrect and error out. Rather, we should
continue walking and only issue an error if we don't
find a match.
I have seen this error before, so I think this report is
a duplicate of something, but can't find the other one
right now.
W.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9665