The following testcase generates a questionable diagnostic:

===================================
struct A {};

template<int> void A::foo() {}
===================================

bug1.cc:3: error: no 'void A::foo()' member function declared in class 'A'
bug1.cc:3: error: template definition of non-template 'void A::foo()'

The second line is bogus, because there is no non-template definition
of A::foo. (This happens since at least GCC 2.95.x).

A slightly different testcase generates an even worse diagnostic:

===================================
struct A {};

template<int> void A::foo();
===================================

bug2.cc:3: error: no 'void A::foo()' member function declared in class 'A'
bug2.cc:3: error: prototype for 'void A::foo()' does not match any in class 'A'
bug2.cc:3: error: candidate is: void A::foo()
bug2.cc:3: error: declaration of 'void A::foo()' outside of class is not
definition
bug2.cc:3: error: template definition of non-template 'void A::foo()'

Here we also have a bogus "candidate is" message.


-- 
           Summary: Bogus error "template definition of non-template" when
                    there is no non-template
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: diagnostic, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27211

Reply via email to