This is the mail archive of the gcc-bugs@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]

[Bug c++/20313] New: poor diagnostic


In:
template<int> struct s1{ s1(int); };

template<int i> s1<i>::s1(int j){}

template<int> struct s;

template<> struct s<0> { s(int); };
template<> struct s<1> { s(int); };

template<int i> s<i>::s(int j) {}

int main() {
    s<0> a(5);
    s1<0> b(5);
    }

you get:
~/ootbc/members/src$ g++ foo.cc
foo.cc:10: error: invalid use of undefined type `struct s<<anonymous> >'
foo.cc:5: error: declaration of `struct s<<anonymous> >'
foo.cc:10: error: template definition of non-template `s<<anonymous> >::s(int)'

This had me mystified enough that I had to reduce my code to this example and 
try it on Comeau, which gives:

Comeau C/C++ 4.3.3 (Aug  6 2003 15:13:37) for ONLINE_EVALUATION_BETA1
Copyright 1988-2003 Comeau Computing.  All rights reserved.
MODE:strict errors C++

"ComeauTest.c", line 10: error: incomplete type is not allowed
  template<int i> s<i>::s(int j) {}
                  ^

"ComeauTest.c", line 10: error: template argument list must match the parameter list
  template<int i> s<i>::s(int j) {}
                  ^

2 errors detected in the compilation of "ComeauTest.c".

With that I saw what my problem was. The gcc diagnostic might be obvious to 
everyone but me, but I doubt it.

Ivan

-- 
           Summary: poor 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=20313


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