public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16093] New: Bad error messages for missing declarations.
@ 2004-06-20 10:56 carlo at gcc dot gnu dot org
  2004-06-20 11:09 ` [Bug c++/16093] " carlo at gcc dot gnu dot org
  2004-06-25 23:02 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: carlo at gcc dot gnu dot org @ 2004-06-20 10:56 UTC (permalink / raw)
  To: gcc-bugs

When a declaration is missing, the error returned by the compiler
is too confusing.  Consider the following short test case;

namespace n {
  int var;
  //class foo { };
  //template<typename T> class bar { };
}

n::var x1;
n::foo x3;
n::bar<int> x4;


The results in the following errors:

test.cc:7: error: `var' in namespace `n' does not name a type
test.cc:8: error: `foo' in namespace `n' does not name a type
test.cc:9: error: expected constructor, destructor, or type conversion before
'<' token
test.cc:9: error: expected `,' or `;' before '<' token

I'd like to suggest a different error for the case that there is
no declaration at all (this could be tested after it is already
detected that there is an error because foo is not a type):

test.cc:8: error: `foo' in namespace `n' is not declared

And of course, an improvement for templates.  For example:

test.cc:9: error: `bar' in namespace `n' is not declared

-- 
           Summary: Bad error messages for missing declarations.
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: carlo at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2004-06-25 22:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-20 10:56 [Bug c++/16093] New: Bad error messages for missing declarations carlo at gcc dot gnu dot org
2004-06-20 11:09 ` [Bug c++/16093] " carlo at gcc dot gnu dot org
2004-06-25 23:02 ` pinskia at gcc dot gnu dot org

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