[cfe-commits] [PATCH][Review request] - superfluous scope specifier inside a class definition

Douglas Gregor dgregor at apple.com
Fri Oct 1 07:46:21 PDT 2010


On Sep 29, 2010, at 1:00 AM, Francois Pichet wrote:

> Hi,
> 
> This patch deals with superfluous scope specifier inside a class
> definition for member functions.
> 
> example:
> class A {
>    void A::foo();
> };

Cool.

> Currently clang gives this error:
> 			
> error: out-of-line declaration of a member must be a definition
>   void A::foo();
>        ~~~^
> error: out-of-line definition of 'foo' does not match any declaration in 'A'
>   void A::foo();
>        ~~~^
> 2 errors generated.
> 
> Not very good error messages since foo is not out-of-line.
> With this patch the error will be:
> error: extra qualification on member 'foo'
>        void A::foo();
>             ~~~^
> 
> As a bonus, I added a fixit to delete the extra A::

Excellent.

> Also the error is downgraded to a warning in Microsoft mode because
> the MSVC header files contain such error in a few places. That's why I
> got interested by this issue.

I'd prefer that this be a warning (rather than an error) in non-Microsoft mode, since it's a common error that isn't harmful to the compiler's state.

With that minor simplification, please go ahead and commit!

	- Doug



More information about the cfe-commits mailing list