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

* [Bug c++/16128] Diagnostic of missing argument list within functions
  2004-06-22  3:53 [Bug c++/16128] New: poor diagnostic igodard at pacbell dot net
@ 2004-06-22 10:46 ` giovannibajo at libero dot it
  2004-06-22 10:47 ` giovannibajo at libero dot it
  1 sibling, 0 replies; 4+ messages in thread
From: giovannibajo at libero dot it @ 2004-06-22 10:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-06-22 10:46 -------
I have fixed this already for GCC 3.5.0. We now get this message for the first 
two lines:

pr16128.cc:10: error: invalid use of template-name `A' without an argument list
pr16128.cc:11: error: invalid use of template-name `H::B' without an argument 
list

I'm interested in checking why the message within the function is different 
though, and to remove the redundant error about the semicolon. But I have other 
patches in queue, so it may take me a little while.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2004-06-22 10:46:54
               date|                            |
            Summary|poor diagnostic             |Diagnostic of missing
                   |                            |argument list within
                   |                            |functions


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/16128] Diagnostic of missing argument list within functions
  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
  1 sibling, 0 replies; 4+ messages in thread
From: giovannibajo at libero dot it @ 2004-06-22 10:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-06-22 10:47 -------
Mine.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |giovannibajo at libero dot
                   |dot org                     |it
             Status|NEW                         |ASSIGNED


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/16128] Diagnostic of missing argument list within functions
       [not found] <bug-16128-4@http.gcc.gnu.org/bugzilla/>
@ 2013-06-17 14:08 ` paolo.carlini at oracle dot com
  0 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-17 14:08 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|gcc-bugs at gcc dot gnu.org        |
         Resolution|---                         |FIXED
           Assignee|giovannibajo at libero dot it      |paolo.carlini at oracle dot com

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Redundant error messages about semicolons fixed in 4.9.0.


^ permalink raw reply	[flat|nested] 4+ messages in thread

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).