Author: rsmith Date: Mon Apr 15 17:47:45 2019 New Revision: 358467 URL: http://llvm.org/viewvc/llvm-project?rev=358467&view=rev Log: PR41192: fix cases where "missing ';' after class" error would incorrectly fire.
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp cfe/trunk/test/CXX/cpp/cpp.module/p2.cpp cfe/trunk/test/Parser/cxx-class.cpp Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=358467&r1=358466&r2=358467&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original) +++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Mon Apr 15 17:47:45 2019 @@ -1248,9 +1248,11 @@ bool Parser::isValidAfterTypeSpecifier(b case tok::ampamp: // struct foo {...} && R = ... case tok::identifier: // struct foo {...} V ; case tok::r_paren: //(struct foo {...} ) {4} + case tok::coloncolon: // struct foo {...} :: a::b; case tok::annot_cxxscope: // struct foo {...} a:: b; case tok::annot_typename: // struct foo {...} a ::b; case tok::annot_template_id: // struct foo {...} a<int> ::b; + case tok::kw_decltype: // struct foo {...} decltype (a)::b; case tok::l_paren: // struct foo {...} ( x); case tok::comma: // __builtin_offsetof(struct foo{...} , case tok::kw_operator: // struct foo operator ++() {...} Modified: cfe/trunk/test/CXX/cpp/cpp.module/p2.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/cpp/cpp.module/p2.cpp?rev=358467&r1=358466&r2=358467&view=diff ============================================================================== --- cfe/trunk/test/CXX/cpp/cpp.module/p2.cpp (original) +++ cfe/trunk/test/CXX/cpp/cpp.module/p2.cpp Mon Apr 15 17:47:45 2019 @@ -13,10 +13,9 @@ template<> struct import<0> { }; // OK, not an import-declaration. -// FIXME: This is valid, see PR41192 -struct A {} // FIXME expected-error {{expected ';'}} +struct A {} ::import -<empty.h>::a; // FIXME expected-error {{requires a type specifier}} +<empty.h>::a; // This is invalid: the tokens after 'import' are a header-name, so cannot be // parsed as a template-argument-list. Modified: cfe/trunk/test/Parser/cxx-class.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-class.cpp?rev=358467&r1=358466&r2=358467&view=diff ============================================================================== --- cfe/trunk/test/Parser/cxx-class.cpp (original) +++ cfe/trunk/test/Parser/cxx-class.cpp Mon Apr 15 17:47:45 2019 @@ -272,6 +272,17 @@ class BadExceptionSpec { )); }; +namespace PR41192 { +extern struct A a; +struct A {} ::PR41192::a; // ok, no missing ';' here expected-warning {{extra qualification}} + +#if __cplusplus >= 201103L +struct C; +struct D { static C c; }; +struct C {} decltype(D())::c; // expected-error {{'decltype' cannot be used to name a declaration}} +#endif +} + // 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}} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits