This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/25497] faults typedef redefinition in struct



------- Comment #1 from gdr at integrable-solutions dot net  2005-12-19 22:45 -------
Subject: Re:   New: faults typedef redefinition in struct

"baraclese at hotmail dot com" <gcc-bugzilla@gcc.gnu.org> writes:

| +++ This bug was initially created as a clone of Bug #7869 +++
| 
| I stumbled over the second issue that the original bug report mentioned. I
| think it was closed prematurely.
| To clarify this a bit I provide my own short example.
| It may be worth noting that comeau online does not produce any errors on this
| code, nor does microsofts c++ compiler that comes with visual studio 8.

That does not make them "right", nor does it turn your invalid code
into valid code.

| struct tag{};
| 
| struct A {
|   tag  t;  // *
|   typedef int tag;
| };
| 
| *omit this declaration and everything is fine for g++
| 
| error msg on g++3.4.4:
| 
| error: declaration of `typedef int A::tag'
| error: changes meaning of `tag' from `struct tag'
| 
| Why would the outer tag declaration conflict with the tag declaration in
scope
| A? This is not an error that I would have expected intuitively which is why
I'd
| like to bring this up again.

The C++ standard says that your program is ill-formed.

-- Gaby


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]