Export (0) Print
Expand All
Expand Minimize

Compiler Error C2752

'template' : more than one partial specialization matches the template argument list

An instantiation was ambiguous.

The following sample generates C2752:

// C2752.cpp
template<class T, class U> 
struct A
{
};

template<class T, class U> 
struct A<T*, U>
{
};

template<class T, class U> 
struct A<T,U*>
{
};

// or uncomment this definition
// template<class T, class U> 
// struct A<T*,U*>
// {
// };

int main()
{
   A<char*,int*> a;   // C2752 an instantiation
   // try one of the following lines instead
   // A<char*,int> a1;
   // A<char,int*> a2;
   // A<char,int> a3;
}
Show:
© 2015 Microsoft