Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Error C2689
Collapse the table of content
Expand the table of content

Compiler Error C2689

'function' : a friend function cannot be defined within a local class

You can declare but not define a friend function in a local class.

The following sample generates C2689:

// C2689.cpp
// compile with: /c
void g() {
   void f2();
   class X {
      friend void f2(){}   // C2689
      friend void f2();   // OK
© 2015 Microsoft