[cfe-dev] [PATCH] Improve diagnostic mistyping ":" for "; " after member function declarations (PR7873)
Mihai Rusu
dizzy at google.com
Fri May 27 17:04:35 PDT 2011
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mistyped-colon-for-semicolon.diff
Type: text/x-patch
Size: 2632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110527/66ec9a30/attachment.bin>
More information about the cfe-dev
mailing list