This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16215] New: Bad error message when requesting member of non-aggregate type
- 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: 25 Jun 2004 23:07:26 -0000
- Subject: [Bug c++/16215] New: Bad error message when requesting member of non-aggregate type
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
In the category "error messages that can be improved"
(and that is not because I am looking for them, but because
they have actually *several times* been confusing me in a real
life situation), please consider the following code snippet:
struct A {
void f();
};
void g()
{
A* a;
a.f();
}
This results in:
test.cc: In function `void g()':
test.cc:8: error: `f' has not been declared
test.cc:8: error: request for member of non-aggregate type before '(' token
This could be improved by putting the "non-aggregate" error first,
or - even better - not displaying the first error in the presence of
the second. Finally, it would be better to add what is the non-aggregate
type. For example:
test.cc: In function `void g()':
test.cc:8: request for member `f' in `a', which is of non-aggregate type `A*'
(Which is the error given by 3.3.3 and below).
I am aware that this looks more like a "feature requests" and an unnecessary
one on top of that - but well, it IS an improvement and it HAS been confusing
me; real-life code (and the resulting errors) looks just a tat-bit different
than these little code snippets.
--
Summary: Bad error message when requesting member of non-
aggregate type
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=16215