This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: C++ typedefs
- To: Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Subject: Re: C++ typedefs
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 22 Feb 1998 20:26:04 -0200
- Cc: egcs-bugs at cygnus dot com
- References: <199802221011.LAA02306@mira.isdn.cs.tu-berlin.de>
Martin von Loewis writes:
> I find that egcs rejects
> void X(){}
> typedef int X;
> as invalid C++ (redeclared as different kind of symbol). I cannot find
> the place in the draft where it says that this is ill-formed.
Dec'97 C++ Standard, in [basic.scope]/4, says:
4 Given a set of declarations in a single declarative region, each of
which specifies the same unqualified name,
--they shall all refer to the same entity, or all refer to functions
and function templates; or
--exactly one declaration shall declare a class name or enumeration
name that is not a typedef name and the other declarations shall all
^^^^^^^^^^^^^^^^^^^^^^^^^^
refer to the same object or enumerator, or all refer to functions
and function templates; in this case the class name or enumeration
name is hidden (_basic.scope.hiding_). [Note: a namespace name or a
class template name must be unique in its declarative region
(_namespace.alias_, clause _temp_). ]
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil