Compiler Error C2756

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Error C2756.

template type' : default template arguments not allowed on a partial specialization

The template for a partial specialization may not contain a default argument.

The following sample generates C2756 and shows how to fix it:

// C2756.cpp  
template <class T>  
struct S {};  
  
template <class T=int>  
// try the following line instead  
// template <class T>  
struct S<T*> {};   // C2756  

Show: