[SOLVED] weakPointerTo.I c++ coding?

Hi,
Just tried to recompile a C++ that used to compile properly… here is what I get

1>C:\Panda3D\include\weakPointerTo.I(46): error #373: "PointerToBase<T>::PointerToBase(T *) [with T=NodePathComponent]" (declared at line 23 of "C:\Panda3D\include\pointerToBase.I") is inaccessible
1>    WeakPointerToBase<T>((const PointerToBase<T> &)copy)
1>                                                   ^
1>          detected during instantiation of "WeakPointerTo<T>::WeakPointerTo(const WeakPointerTo<T> &) [with T=NodePathComponent]" at line 35 of "C:\Panda3D\include\weakNodePath.I"
1>
1>C:\Panda3D\include\weakPointerTo.I(46): error #373: "PointerToBase<T>::~PointerToBase() [with T=NodePathComponent]" (declared at line 45 of "C:\Panda3D\include\pointerToBase.I") is inaccessible
1>    WeakPointerToBase<T>((const PointerToBase<T> &)copy)
1>                                                   ^
1>          detected during instantiation of "WeakPointerTo<T>::WeakPointerTo(const WeakPointerTo<T> &) [with T=NodePathComponent]" at line 35 of "C:\Panda3D\include\weakNodePath.I"
1>
1>C:\Panda3D\include\weakPointerTo.I(149): error #373: "PointerToBase<T>::PointerToBase(T *) [with T=NodePathComponent]" (declared at line 23 of "C:\Panda3D-1.7.1\include\pointerToBase.I") is inaccessible
1>    ((WeakPointerTo<T> *)this)->reassign((const PointerToBase<T> &)copy);
1>                                                                   ^
1>          detected during instantiation of "WeakPointerTo<T> &WeakPointerTo<T>::operator=(const WeakPointerTo<T> &) [with T=NodePathComponent]" at line 67 of "C:\Panda3D-1.7.1\include\weakNodePath.I"
1>
1>C:\Panda3D\include\weakPointerTo.I(149): error #373: "PointerToBase<T>::~PointerToBase() [with T=NodePathComponent]" (declared at line 45 of "C:\Panda3D\include\pointerToBase.I") is inaccessible
1>    ((WeakPointerTo<T> *)this)->reassign((const PointerToBase<T> &)copy);

Any idea of what may be happening here?

Is the weakPointer/pointertobase code full c++ standard compliant?

Huh, that’s strange. Your compiler seems to be interpreting (const PointerToBase &)copy as const PointerToBase(copy), which is a completely different interpretation.

Which compiler version are you using?

David

Hi David,

I’m using Intel C++ compiler which is known to be really strict in term of c++.

A couple of day ago I upgraded it to the new release.

As a result :

I did successfully recompile the full Panda 1.8 build so this is ok.
but for my c++ app. this error pops up…

PS. Should I put some pair of parenthesis in well choosen places to help the compiler??

Hmm, I think this is a bug in the compiler, especially because it can build Panda itself successfully but chokes when building your app (which is, after all, simply including the same header files that worked perfectly when building Panda).

Still, it’s far from the first compiler bug we’ve worked around. I’ve just committed a change to weakPointerTo.I that replaces this syntax with a much more explicit syntax that should be harder for the compiler to misunderstand. Give it a try and let me know if it works.

David

Fine this way: it does compile properly now!
Thanks
Jean-Claude