This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: wrong reference in a virtual table
- To: Igor Levko <hornet at reksoft dot ru>
- Subject: Re: wrong reference in a virtual table
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 23 Jun 1998 20:26:48 -0300
- Cc: egcs-bugs at cygnus dot com
- References: <358A46F2.C8FF0E19@reksoft.ru>
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