Compiler Warning (level 3) C4686
TOC
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

Compiler Warning (level 3) C4686

' user-defined type ' : possible change in behavior, change in UDT return calling convention

A class template specialization was not is defined before it was used in a return type. Anything that instantiates the class will resolve C4686; declaring an instance or accessing a member (C<int>::anything) are also options.

This warning is the result of work to make the Visual C++ .NET 2003 compiler conform to the ISO C++ standard.

See Summary of Compiler-Time Breaking Changes for more information.

This warning is off by default. See Compiler Warnings That Are Off by Default for more information.

Try the following instead,

// C4686.cpp
// compile with: /W3
#pragma warning (default : 4686)
template <class T>
class C;

template <class T>
C<T> f(T);

template <class T>
class C {};

int main() {
   f(1);   // C4686
}

template <class T>
C<T> f(T) {
   return C<int>();
}
Show:
© 2016 Microsoft