[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Strange problem with msvc in kdepimlibs/kcal
From:       Peter_Kümmel <syntheticpp () gmx ! net>
Date:       2006-07-21 7:50:09
Message-ID: 44C08731.1020604 () gmx ! net
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic