Implicit copy constructor for virtual bases
Martin v. Loewis
martin@mira.isdn.cs.tu-berlin.de
Thu Mar 25 00:05:00 GMT 1999
While reviewing expected testsuite failures, I ran into
g++.jason/opeq5.C. It copies a virtual base more than once and marks
this as a failure. It also refers to gxxint.texi, which says
>> This issue is currently under discussion in the core reflector
>> (2/28/94).
Now, some time has passed since, we have a standard, which says
>> It is unspecified whether subobjects representing virtual base
>> classes are assigned more than once by the implicitlyÃÂdefined copy
>> assignment operator.
Based on that, it seems there are a number of options:
a) we could leave everything as-is, hoping that it will get some day
'fixed' in the sense proposed by gxxint.texi (i.e. being smart
about not copying things twice)
b) document the current behaviour, ie. make it
'implementation-defined'.
c) issue a warning saying that one might get duplicate copies, in cases
we can detect. If user-defined copy-assignments are involved, such
a warning is a guess; otherwise, it is a fact.
Any opinions?
Martin
More information about the Gcc
mailing list