Visual C++ Compiler Warning C4630

Message Text

'symbol' : 'specifier' storage-class specifier illegal on member definition

Severity

This is a level 1 warning if the Microsoft language extensions are enabled (as by /Ze, which is the default). Otherwise, it is not a warning but an error (C2720).

Circumstances

The specifier is necessarily extern. The symbol is a member function whose definition outside its class has the extern storage-class specifier.

Example

In the following declaration of func as a member function of class Test, the extern is an error (C2720) whether Microsoft’s language extensions are enabled or not:

class Test
{
    extern void func (void);            // C2720
}

Under /Za, it is also the same error to apply extern if defining func outside the class:

class Test
{
    void func (void);
};

extern void Test :: func (void)
{                                       // C2720 if /Za or C4630 if /Ze
}

but if compiled with /Ze, the otherwise troublesome extern is discarded, with warning C4630.