This is the mail archive of the gcc@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: typeid().name() for references


David J Murray <1dmurray@home.com> writes:

> Can anyone tell me why typeid(X&).name() == typeid(X).name() ?  Is this
> the desired result?

Yes, [expr.typeid] says:

4 When  typeid is applied to a type-id, [...]   If the type of the type-
  id  is a reference type, the result of the typeid expression refers to
  a type_info object representing the referenced type. [...]

-- 
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]