summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser/cxx-decl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-10-15 00:00:26 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-10-15 00:00:26 +0000
commitfb8b7b9a1c524c420728d1814997d6e988f992de (patch)
tree020250997da147b7c85dad004ee0f34e06bfa89b /clang/test/Parser/cxx-decl.cpp
parentb0cba4ce7570727d30510946b38588265a14efb1 (diff)
downloadbcm5719-llvm-fb8b7b9a1c524c420728d1814997d6e988f992de.tar.gz
bcm5719-llvm-fb8b7b9a1c524c420728d1814997d6e988f992de.zip
PR17567: Improve diagnostic for a mistyped constructor name. If we see something
that looks like a function declaration, except that it's missing a return type, try typo-correcting it to the relevant constructor name. In passing, fix a bug where the missing-type-specifier recovery codepath would drop a preceding scope specifier on the floor, leading to follow-on diagnostics and incorrect recovery for the auto-in-c++98 hack. llvm-svn: 192644
Diffstat (limited to 'clang/test/Parser/cxx-decl.cpp')
-rw-r--r--clang/test/Parser/cxx-decl.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/Parser/cxx-decl.cpp b/clang/test/Parser/cxx-decl.cpp
index ea20354bf9a..06272504bc5 100644
--- a/clang/test/Parser/cxx-decl.cpp
+++ b/clang/test/Parser/cxx-decl.cpp
@@ -223,6 +223,15 @@ void foo() {
}
}
+namespace PR17567 {
+ struct Foobar { // expected-note 2{{declared here}}
+ FooBar(); // expected-error {{missing return type for function 'FooBar'; did you mean the constructor name 'Foobar'?}}
+ ~FooBar(); // expected-error {{expected the class name after '~' to name a destructor}}
+ };
+ FooBar::FooBar() {} // expected-error {{undeclared}} expected-error {{missing return type}}
+ FooBar::~FooBar() {} // expected-error {{undeclared}} expected-error {{expected the class name}}
+}
+
// PR8380
extern "" // expected-error {{unknown linkage language}}
test6a { ;// expected-error {{C++ requires a type specifier for all declarations}} \
OpenPOWER on IntegriCloud