mono / CppSharp

Tools and libraries to glue C/C++ APIs to high-level languages
MIT License
3.08k stars 505 forks source link

Ambigious type specialization in symbols.cpp #1054

Open rokups opened 6 years ago

rokups commented 6 years ago

C++ code:

    WeakPtr(const WeakPtr<T>& rhs) noexcept :
        ptr_(rhs.ptr_),
        refCount_(rhs.refCount_)
    {
        AddRef();
    }

    /// Copy-construct from another weak pointer allowing implicit upcasting.
    template <class U> WeakPtr(const WeakPtr<U>& rhs) noexcept :   // NOLINT
        ptr_(rhs.ptr_),
        refCount_(rhs.refCount_)
    {
        AddRef();
    }

Specialization:

template Urho3D::WeakPtr<Urho3D::Component>::WeakPtr(const Urho3D::WeakPtr<Urho3D::Component>&) noexcept;

Compiler error:

../../Urho3DNet/Urho3DNet-symbols.cpp:1549:10: error: ambiguous template specialization ‘WeakPtr<>’ for ‘Urho3D::WeakPtr<Urho3D::Component>::WeakPtr(const Urho3D::WeakPtr<Urho3D::Component>&)’
 template Urho3D::WeakPtr<Urho3D::Component>::WeakPtr(const Urho3D::WeakPtr<Urho3D::Component>&) noexcept;
          ^~~~~~
In file included from ../../Urho3DNet/Urho3DNet-symbols.cpp:10:0:
/tmp/Urho3D-SDK/include/Urho3D/Container/Ptr.h:261:5: note: candidates are: Urho3D::WeakPtr<T>::WeakPtr(const Urho3D::WeakPtr<T>&) [with T = Urho3D::Component]
     WeakPtr(const WeakPtr<T>& rhs) noexcept :
     ^~~~~~~
/tmp/Urho3D-SDK/include/Urho3D/Container/Ptr.h:269:24: note:                 template<class U> Urho3D::WeakPtr<T>::WeakPtr(const Urho3D::WeakPtr<U>&) [with U = U; T = Urho3D::Component]
     template <class U> WeakPtr(const WeakPtr<U>& rhs) noexcept :   // NOLINT
ddobrev commented 6 years ago

@tritao any idea how we should make a difference between these two?