Edit

Share via


Compiler Error C2526

'identifier1' : C linkage function cannot return C++ class 'identifier2'

A function defined with C linkage cannot return a user-defined type.

The following sample generates C2526:

// C2526.cpp
// compile with: /c
template <typename T>
class A {};

extern "C" A<int> func()   // C2526
{
    return A<int>();
}