Resolve an ambiguous template specialization

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Resolve an ambiguous template specialization

Hubert Tong via cfe-dev
Hello all,

I have 2 methods in a C++ header.

I'm trying to compile this code:

template QSharedPointer<QTemporaryDir>::QSharedPointer(const

I get "ambiguous template specialization".

include/QtCore/qsharedpointer_impl.h:330: candidates are:
QSharedPointer<T>::QSharedPointer(const QSharedPointer<T>&) [with T =
QTemporaryDir] QSharedPointer(const QSharedPointer &other)
Q_DECL_NOTHROW : value(other.value), d(other.d)      ^~~~~~~~~~~~~~

note:                 template<class X>
QSharedPointer<T>::QSharedPointer(const QSharedPointer<X>&) [with X = X;
T = QTemporaryDir] QSharedPointer(const QSharedPointer<X> &other)
Q_DECL_NOTHROW : value(other.value), d(other.d) ^~~~~~~~~~~~~~

I have 2 questions:

1. What syntax do I need in order to make my line of code unambiguous?

2. How do I make the difference in the Clang API between the two
functions? Of course, I'm not talking about line numbers or names of
type arguments but rather the specialization info, or the fact that the
latter might be a function template etc.


Dimitar Dobrev

cfe-dev mailing list
[hidden email]