summaryrefslogtreecommitdiffstats
path: root/clang/test/FixIt/fixit-cxx0x.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-11-29 05:27:40 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-11-29 05:27:40 +0000
commit675ea99a2a69e82159996035cc3279579531a9a2 (patch)
tree2faa3feafd8586acda8b159eb77d977d71416249 /clang/test/FixIt/fixit-cxx0x.cpp
parentad9e828c89bd51e5bd104aede1e08c05bc4a8491 (diff)
downloadbcm5719-llvm-675ea99a2a69e82159996035cc3279579531a9a2.tar.gz
bcm5719-llvm-675ea99a2a69e82159996035cc3279579531a9a2.zip
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 '{'. llvm-svn: 145372
Diffstat (limited to 'clang/test/FixIt/fixit-cxx0x.cpp')
-rw-r--r--clang/test/FixIt/fixit-cxx0x.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/FixIt/fixit-cxx0x.cpp b/clang/test/FixIt/fixit-cxx0x.cpp
index 9fb647d03fc..d9b8763b056 100644
--- a/clang/test/FixIt/fixit-cxx0x.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud