Strange problem with msvc in kdepimlibs/kcal

Peter Kümmel syntheticpp at gmx.net
Fri Jul 21 08:50:09 BST 2006


Christian Ehrlicher wrote:
> Hi,
> 
> I want to compile kdepimlibs with msvc (because kdebase needs it) and after some minor problems I now get a strange error in kcal. I've attached a small testcase to show the problem.
> 
> The output with gcc:
> 
> D - Recurrence::Observer::Observer()
> G - Incidence::Incidence()
> A - RecurrenceRule::Observer::Observer()
> E - Recurrence::Recurrence()
> F - void Recurrence::addObserver(Recurrence::Observer*)
> 
> and msvc:
> 
> A - RecurrenceRule::Observer::Observer
> G - Incidence::Incidence
> A - RecurrenceRule::Observer::Observer
> E - Recurrence::Recurrence
> F - Recurrence::addObserver
> 
> As you can see, different constructors are called.
> In my understanding, both of them are correct. But I don't know what the c++ standard says about such an ambiguity.
> 
> Any ideas how this could be solved without renaming one of the classes? 
> 
> Christian

Very interesting.
Looks like a compiler bug.
So whats the correct behavior?

Incidence::Incidence() : Recurrence::Observer()

Which Observer is the correct one, the inherited or that one
defined in Recurrence? I think that of Recurrence because if not
then Recurrence::Observer and RecurrenceRule::Observer means the same.

It's definitely a msvc bug because this compiles:

class Incidence : public RecurrenceRule::Observer
Incidence::Incidence() : Recurrence::Observer()

and gcc tells the truth:
type `class Recurrence::Observer' is not a direct base of `Incidence'

So the only solution seems to be a renaming of one of the Observers,
or to change inheritance tree.

Peter




More information about the kde-core-devel mailing list