[cfe-dev] [PATCH] Improve diagnostic mistyping ":" for "; " after member function declarations (PR7873)

Mihai Rusu dizzy at google.com
Tue Jun 14 19:23:59 PDT 2011


Ping?

On Fri, May 27, 2011 at 5:04 PM, Mihai Rusu <dizzy at google.com> wrote:
> Hi,
>
> This is my first patch sent directly to clang upstream, please be gentle :)
>
> "git show" generated patch, apply with -p1 in .../tools/clang. Passes
> "make clang-test" (I'm using cmake builds).
>
> When trying the same mistype with namespace scope declarations we have
> a somewhat better situation, the first diagnostic is confusing the the
> next one is pretty clear. I could try to address this case too if it
> seems valuable.
>
> $ cat case-7873.cc
> class Class {
>  int m;
>  Class();
>  virtual ~Class():
>  virtual int Func();
> };
>
> int Class::Func():
> Class::Class():m(10){}
>
> $ ./bin/clang++ -fsyntax-only case-7873.cc
> # Generated by the patch.
> case-7873.cc:4:19: error: unexpected ':' in (non-constructor) member function
>      declaration
>  virtual ~Class():
>                  ^
>                  ;
>
> # Current diagnostic for namespace scope mistyped declarations.
> case-7873.cc:9:15: error: expected '{' or ','
> Class::Class():m(10){}
>              ^
> case-7873.cc:8:18: error: only constructors take base initializers
> int Class::Func():
>                 ^
> 3 errors generated.
>
> --
> Mihai Rusu
>



-- 
Mihai Rusu




More information about the cfe-dev mailing list