diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-11-29 05:27:40 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-11-29 05:27:40 +0000 |
commit | 874d253668f9ed183ca409cdff9d424925ee7800 (patch) | |
tree | 637fc2dc1c9b792795c6f63d5cf68061c347caa2 /test/FixIt/fixit.cpp | |
parent | b49e728a4d1a84b72f3aebf60ff494684f9cb004 (diff) |
PR10101: Recover better from a common copy-paste error: if a function
declaration at namespace scope is followed by a semicolon and an open-brace
(or in C++, a 'try', ':' or '='), then the error is probably a function
definition with a spurious ';', rather than a mysterious '{'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145372 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/FixIt/fixit.cpp')
-rw-r--r-- | test/FixIt/fixit.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/FixIt/fixit.cpp b/test/FixIt/fixit.cpp index 86b397777c..7c8ba9ac6f 100644 --- a/test/FixIt/fixit.cpp +++ b/test/FixIt/fixit.cpp @@ -125,3 +125,13 @@ AD oopsMoreCommas() { AD ad, // expected-error {{expected ';' at end of declaration}} return ad; } + +int extraSemi1(); // expected-error {{stray ';' in function definition}} +{ + return 0; +} + +int extraSemi2(); // expected-error {{stray ';' in function definition}} +try { +} catch (...) { +} |