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]

Re: C++ typedefs


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


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