diff options
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 3 | ||||
-rw-r--r-- | clang/test/Parser/cxx-class.cpp | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 2c93def4c2b..9d8af30b5bf 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -1725,7 +1725,8 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS, } else { if (Tok.is(tok::l_brace)) { Diag(Tok, diag::err_function_definition_not_allowed); - SkipUntil(tok::r_brace, StopAtSemi | StopBeforeMatch); + SkipMalformedDecl(); + return DeclGroupPtrTy(); } } } diff --git a/clang/test/Parser/cxx-class.cpp b/clang/test/Parser/cxx-class.cpp index 5fac7972857..d4d8c449436 100644 --- a/clang/test/Parser/cxx-class.cpp +++ b/clang/test/Parser/cxx-class.cpp @@ -113,6 +113,16 @@ namespace PR13775 { } } +class pr16989 { + void tpl_mem(int *) { + return; + class C2 { + void f(); + }; + void C2::f() {} // expected-error{{function definition is not allowed here}} + }; +}; + // PR11109 must appear at the end of the source file class pr11109r3 { // expected-note{{to match this '{'}} public // expected-error{{expected ':'}} expected-error{{expected '}'}} expected-error{{expected ';' after class}} |