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: wrong reference in a virtual table


Thanks a lot for the answer.

But it doesn't help because  the current version egcs (gcc version
egcs-2.90.29 980515 (egcs-1.0.3 release))
doesn't support namespace !!!
I'v got:
sorry, not implemented: namespace

This classes with the same name are defined in different .cc files hence the
compiler has to issue an
                                                    ^^^^^^^^^^^^^^^^^^^^^
error or generate correct code, doesn't it ?

IMHO this is important for the libraries or codegenerators.

Best regards,
Igor Levko
hornet@reksoft.ru
Russia, St.Petersburg

Alexandre Oliva wrote:

> Igor Levko ?hornet@reksoft.ru? writes:
>
> ? There is a trick here. There are two classes defined with the same name
> ? - X
> ? but the definitions are in different .cc files.
>
> That doesn't make this valid; you're violating the One Definition
> Rule.  The problem is that a single virtual table for class X is
> generated.  You may fix your program by defining class X in unnamed
> namespaces; this will ensure that the different definitions are not
> mixed up.
>
> namespace {
>   class X { /* ... */ };
> }
>
> --
> 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]