[Bug c++/20906] New: bad diagnostic

igodard at pacbell dot net gcc-bugzilla@gcc.gnu.org
Fri Apr 8 18:50:00 GMT 2005


in:

template<int> struct bar {};
template<int i> struct foo { void pop(bar<i>& b, int j); };
template<int k> void foo<k>::pop(bar&, int) {}


you get:

~/ootbc/members/src$ g++ foo.cc
foo.cc:3: error: variable or field `pop' declared void
foo.cc:3: error: `int foo<i>::pop' is not a static member of `struct foo<i>'
foo.cc:3: error: template definition of non-template `int foo<i>::pop'
foo.cc:3: error: missing template arguments before '&' token
foo.cc:3: error: expected primary-expression before ',' token
foo.cc:3: error: expected primary-expression before "int"
foo.cc:3: error: expected `;' before '{' token


The actual problem is that "bar" in line 3 should be "bar<k>", which appears to
be what the fourth of the above errors is about. The other six seem to be detritus.

Ivan

-- 
           Summary: bad diagnostic
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list