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-cxx0x.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-cxx0x.cpp')
-rw-r--r-- | test/FixIt/fixit-cxx0x.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/FixIt/fixit-cxx0x.cpp b/test/FixIt/fixit-cxx0x.cpp index 9fb647d03f..d9b8763b05 100644 --- a/test/FixIt/fixit-cxx0x.cpp +++ b/test/FixIt/fixit-cxx0x.cpp @@ -58,3 +58,26 @@ namespace SemiCommaTypo { n [[]], // expected-error {{expected ';' at end of declaration}} int o; } + +int extraSemi(); // expected-error {{stray ';' in function definition}} + = delete; + +class ExtraSemi { +public: + ExtraSemi(); + ExtraSemi(const ExtraSemi &); + int n; +}; +ExtraSemi::ExtraSemi(); // expected-error {{stray ';'}} + : n(0) { +} +ExtraSemi::ExtraSemi(const ExtraSemi &); // expected-error {{stray ';'}} + = default; + +template<typename T> T extraSemi(T t); + +template<typename T> T extraSemi(T t); // expected-error {{stray ';'}} +{ + return t; +} +template int extraSemi(int); |