This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/9665: error with member and member template of same name


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]