Export (0) Print
Expand All
Expand Minimize
1 out of 1 rated this helpful - Rate this topic

Compiler Error C3637

'function' : a friend function definition cannot be a specialization of a function type

A friend function was defined incorrectly for a template or generic.

The following sample generates C3637:

// C3637.cpp
template <class T>
void f();

struct S {
   friend void f<int>() {}   // C3637
};

Possible resolution:

// C3637b.cpp
// compile with: /c
template <class T>
void f();

struct S {
   friend void f() {}
};

C3637 can also occur when using generics:

// C3637c.cpp
// compile with: /clr

generic <class T>
void gf();

struct S {
   friend void gf<int>() {}   // C3637
};

Possible resolution:

// C3637d.cpp
// compile with: /clr /c
generic <class T>
void gf();

struct S {
   friend void gf() {}
};
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.