Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Warning (level 1) C4544

Default arguments on template declaration ignored

A default template argument was specified in an incorrect location and was ignored. A default template argument for a class template can only be specified in the declaration or definition of the class template and not on a member of the class template.

The following sample generates C4545:

// C4544.cpp
// compile with: /W1 /LD
template <class T> 
struct S
{
   template <class T1> 
      struct S1;
   void f();
};

template <class T=int>
template <class T1>
struct S<T>::S1 {};   // C4544

In the following example, the default parameter applies to class template S:

// C4544b.cpp
// compile with: /LD
template <class T = int> 
struct S
{
   template <class T1> 
      struct S1;
   void f();
};

template <class T>
template <class T1>
struct S<T>::S1 {};

Community Additions

ADD
Show:
© 2015 Microsoft