public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30060] Error/warning on invalid code (duplicate identifier for enum/class) should be more specific
[not found] <bug-30060-4@http.gcc.gnu.org/bugzilla/>
@ 2021-09-28 8:16 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-28 8:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30060
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
clang gives a much better diagnostic for sure:
<source>:10:20: error: must use 'class' tag to refer to type 'foo' in this
scope
foo *a=new foo;
^
class
<source>:2:9: note: class 'foo' is hidden by a non-type declaration of 'foo'
here
foo = 1
^
<source>:10:20: error: allocation of incomplete type 'class foo'
foo *a=new foo;
^~~
<source>:10:20: note: forward declaration of 'foo'
<source>:10:14: error: use of undeclared identifier 'a'
foo *a=new foo;
^
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/30060] Error/warning on invalid code (duplicate identifier for enum/class) should be more specific
2006-12-03 18:42 [Bug c++/30060] New: " bero at arklinux dot org
2006-12-03 18:56 ` [Bug c++/30060] " pinskia at gcc dot gnu dot org
2006-12-03 19:05 ` bero at arklinux dot org
@ 2006-12-04 16:11 ` bangerth at dealii dot org
2 siblings, 0 replies; 4+ messages in thread
From: bangerth at dealii dot org @ 2006-12-04 16:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from bangerth at dealii dot org 2006-12-04 16:11 -------
Confirmed. While there may not be much that can be done at the place
where the current error is reported, the warning is definitely a valid
request.
W.
--
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |diagnostic
Last reconfirmed|0000-00-00 00:00:00 |2006-12-04 16:11:48
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30060
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/30060] Error/warning on invalid code (duplicate identifier for enum/class) should be more specific
2006-12-03 18:42 [Bug c++/30060] New: " bero at arklinux dot org
2006-12-03 18:56 ` [Bug c++/30060] " pinskia at gcc dot gnu dot org
@ 2006-12-03 19:05 ` bero at arklinux dot org
2006-12-04 16:11 ` bangerth at dealii dot org
2 siblings, 0 replies; 4+ messages in thread
From: bero at arklinux dot org @ 2006-12-03 19:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from bero at arklinux dot org 2006-12-03 19:05 -------
True, but the warning bit (test.cpp:2: warning: declaration of enum value 'foo'
shadows class 'foo') should be doable (and would make the rest much easier to
spot).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30060
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/30060] Error/warning on invalid code (duplicate identifier for enum/class) should be more specific
2006-12-03 18:42 [Bug c++/30060] New: " bero at arklinux dot org
@ 2006-12-03 18:56 ` pinskia at gcc dot gnu dot org
2006-12-03 19:05 ` bero at arklinux dot org
2006-12-04 16:11 ` bangerth at dealii dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-03 18:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-12-03 18:56 -------
Actually I think the error is clear once you remember * is also multiplication.
so we have
foo * a = new foo;
Also I doubt we can improve the error message here.
Cameau online gives basically the same error message:
"ComeauTest.c", line 10: error: identifier "a" is undefined
foo *a=new foo;
^
"ComeauTest.c", line 10: error: expected a type specifier
foo *a=new foo;
^
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30060
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-09-28 8:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-30060-4@http.gcc.gnu.org/bugzilla/>
2021-09-28 8:16 ` [Bug c++/30060] Error/warning on invalid code (duplicate identifier for enum/class) should be more specific pinskia at gcc dot gnu.org
2006-12-03 18:42 [Bug c++/30060] New: " bero at arklinux dot org
2006-12-03 18:56 ` [Bug c++/30060] " pinskia at gcc dot gnu dot org
2006-12-03 19:05 ` bero at arklinux dot org
2006-12-04 16:11 ` bangerth at dealii 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).