This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12862] New: rejects-valid: Conflicts Between typedefs/enums and Namespace Member Declarations
- From: "hlaw at geosci dot usyd dot edu dot au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Oct 2003 21:02:54 -0000
- Subject: [Bug c++/12862] New: rejects-valid: Conflicts Between typedefs/enums and Namespace Member Declarations
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12862
Summary: rejects-valid: Conflicts Between typedefs/enums and
Namespace Member Declarations
Product: gcc
Version: 3.2.2
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hlaw at geosci dot usyd dot edu dot au
CC: gcc-bugs at gcc dot gnu dot org,hlaw at geosci dot usyd
dot edu dot au
GCC build triplet: i386-redhat-linux
GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux
G++ rejects the following valid code, claiming that 'void A::Thingo()' is a
redeclaration of 'typedef int Thingo'.
The error goes away if:
- you wrap the typedef in an anonymous namespace;
- you include the definition of void A::Thingo() in
namespace A.
The error remains if:
- you replace the typedef with enum { Thingo };
---- test.cc ----
typedef int Thingo;
namespace A
{
void
Thingo();
}
void
A::Thingo()
{
;
}
int
main()
{
A::Thingo();
return 0;
}
---- EOF ----
$ g++ test.cc
test.cc: In function `void A::Thingo()':
test.cc:11: `void A::Thingo()' redeclared as different kind of symbol
test.cc:1: previous declaration of `typedef int Thingo'
$ g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/u
sr/share/info --enable-shared --enable-threads=posix --disable-checking --with-s
ystem-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)