public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16128] New: poor diagnostic
@ 2004-06-22  3:53 igodard at pacbell dot net
  2004-06-22 10:46 ` [Bug c++/16128] Diagnostic of missing argument list within functions giovannibajo at libero dot it
  2004-06-22 10:47 ` giovannibajo at libero dot it
  0 siblings, 2 replies; 4+ messages in thread
From: igodard at pacbell dot net @ 2004-06-22  3:53 UTC (permalink / raw)
  To: gcc-bugs

template<typename T>
struct A {
    };

namespace H {
    template<typename T>
    struct B {};
    };

A a;
H::B b;

int main() {
    A a;
    H::B b;
    return 0;
    }


produces:

~/ootbc/common/test/src$ g++ foo.cc
foo.cc:10: error: `A' does not name a type
foo.cc:11: error: expected constructor, destructor, or type conversion before "b"
foo.cc:11: error: expected `,' or `;' before "b"
foo.cc: In function `int main()':
foo.cc:14: error: missing template arguments before "a"
foo.cc:14: error: expected `;' before "a"
foo.cc:15: error: missing template arguments before "b"
foo.cc:15: error: expected `;' before "b"

Oddly, the diagnostic produced when the error is inside a function is different from (and better than) that for the same error in file scope. And why the (bad) messages differ when the template is or is not namespace-qualified beats me.

Lastly, the missing ";" message seems redundant in all cases.

Ivan

p.s. Comeau 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 8: error: extra ";" ignored,
        In C: A function definition does not end with a semicolon
        In C++: A function definition, extern "C" or namespace, does not end with a semicolon
      };
       ^

"ComeauTest.c", line 10: error: argument list for class template "A" is missing
  A a;
  ^

"ComeauTest.c", line 11: error: argument list for class template "H::B" is missing
  H::B b;
  ^

"ComeauTest.c", line 14: error: argument list for class template "A" is missing
      A a;
      ^

"ComeauTest.c", line 15: error: argument list for class template "H::B" is missing
      H::B b;
      ^

"ComeauTest.c", line 15: error: expected a ";" (perhaps on the previous statement)
      H::B b;
           ^

"ComeauTest.c", line 14: warning: variable "a" was declared but never referenced
      A a;
        ^

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

-- 
           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=16128


^ permalink raw reply	[flat|nested] 4+ messages in thread
[parent not found: <bug-16128-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2013-06-17 14:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-22  3:53 [Bug c++/16128] New: poor diagnostic igodard at pacbell dot net
2004-06-22 10:46 ` [Bug c++/16128] Diagnostic of missing argument list within functions giovannibajo at libero dot it
2004-06-22 10:47 ` giovannibajo at libero dot it
     [not found] <bug-16128-4@http.gcc.gnu.org/bugzilla/>
2013-06-17 14:08 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).