This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16093] New: Bad error messages for missing declarations.
- From: "carlo at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Jun 2004 10:56:50 -0000
- Subject: [Bug c++/16093] New: Bad error messages for missing declarations.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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