[Bug c++/15786] New: [regression 3.5/3.4.0] Bad error message for frequently occuring error.
carlo at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Jun 2 21:28:00 GMT 2004
I've run so many times into this now that I feel that it is important to get it
fixed.
The following code snippet,
struct A {
void foo(bar* p);
};
Gives as error message:
>g++-cvs-3.5 -c test.cc
test.cc:2: error: variable or field `foo' declared void
test.cc:2: error: expected `;' before '(' token
Only when foo is not a member function, there also appears
a MUCH more correct error message:
test.cc:1: error: variable or field `foo' declared void
test.cc:1: error: `bar' was not declared in this scope
test.cc:1: error: `p' was not declared in this scope
If possible, the `bar' was not declared in this scope should
come first - and it should definitely also be printed in
the case of the member function.
3.4.0 does the same unclear thing.
You can consider this a regression because 3.3.3 gives most
sensible output:
>g++-3.3.3 -c test.cc
test.cc:2: error: `bar' was not declared in this scope
test.cc:2: error: `p' was not declared in this scope
test.cc:2: error: invalid data member initialization
test.cc:2: error: (use `=' to initialize static data members)
test.cc:2: error: variable or field `foo' declared void
--
Summary: [regression 3.5/3.4.0] Bad error message for frequently
occuring error.
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=15786
More information about the Gcc-bugs
mailing list