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

Compiler Error C2549

user-defined conversion cannot specify a return type

The following sample generates C2549:

// C2549.cpp
// compile with: /c
class X {
public:
   int operator int() { return value; }   // C2549

   // try the following line instead
   // operator int() { return value; }
private:
   int value;
};

Community Additions

ADD
Show:
© 2015 Microsoft