From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 338E1385E82C for ; Mon, 16 Mar 2020 14:04:06 +0000 (GMT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-490-rBRGN2ZSN6yBOktEo-5ngQ-1; Mon, 16 Mar 2020 10:04:04 -0400 X-MC-Unique: rBRGN2ZSN6yBOktEo-5ngQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5453E80269A; Mon, 16 Mar 2020 14:04:03 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-37.ams2.redhat.com [10.36.116.37]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DA33F91291; Mon, 16 Mar 2020 14:04:02 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 02GE401w018556; Mon, 16 Mar 2020 15:04:00 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 02GE3xNQ018555; Mon, 16 Mar 2020 15:03:59 +0100 Date: Mon, 16 Mar 2020 15:03:59 +0100 From: Jakub Jelinek To: test-list@sourceware.org Cc: jakub@gcc.gnu.org Subject: Test patch Message-ID: <20200316140359.GN2156@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Spam-Status: No, score=-10.2 required=5.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: test-list@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Test-list mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Mar 2020 14:04:07 -0000 Hi! Testing Content-Transfer-Encoding changes. 2020-03-15 Jakub Jelinek =09PR c++/90995 =09* parser.c (cp_parser_enum_specifier): Use temp_override for =09parser->colon_corrects_to_scope_p, replace goto out with return. =09If scoped enum or enum with underlying type is not followed by =09{ or ;, call error_at rather than cp_parser_error. Formatting fixes. =09* g++.dg/cpp0x/enum40.C: New test. --- gcc/cp/parser.c.jj=092020-03-14 08:14:47.125740994 +0100 +++ gcc/cp/parser.c=092020-03-15 22:39:09.003266300 +0100 @@ -19001,9 +19001,7 @@ cp_parser_enum_specifier (cp_parser* par bool is_unnamed =3D false; tree underlying_type =3D NULL_TREE; cp_token *type_start_token =3D NULL; - bool saved_colon_corrects_to_scope_p =3D parser->colon_corrects_to_scope= _p; - - parser->colon_corrects_to_scope_p =3D false; + temp_override cleanup (parser->colon_corrects_to_scope_p, false); =20 /* Parse tentatively so that we can back up if we don't find a enum-specifier. */ @@ -19043,24 +19041,24 @@ cp_parser_enum_specifier (cp_parser* par =20 push_deferring_access_checks (dk_no_check); nested_name_specifier - =3D cp_parser_nested_name_specifier_opt (parser, -=09=09=09=09=09 /*typename_keyword_p=3D*/true, -=09=09=09=09=09 /*check_dependency_p=3D*/false, -=09=09=09=09=09 /*type_p=3D*/false, -=09=09=09=09=09 /*is_declaration=3D*/false); + =3D cp_parser_nested_name_specifier_opt (parser, +=09=09=09=09=09 /*typename_keyword_p=3D*/true, +=09=09=09=09=09 /*check_dependency_p=3D*/false, +=09=09=09=09=09 /*type_p=3D*/false, +=09=09=09=09=09 /*is_declaration=3D*/false); =20 if (nested_name_specifier) { tree name; =20 identifier =3D cp_parser_identifier (parser); - name =3D cp_parser_lookup_name (parser, identifier, -=09=09=09=09 enum_type, -=09=09=09=09 /*is_template=3D*/false, -=09=09=09=09 /*is_namespace=3D*/false, -=09=09=09=09 /*check_dependency=3D*/true, -=09=09=09=09 /*ambiguous_decls=3D*/NULL, -=09=09=09=09 input_location); + name =3D cp_parser_lookup_name (parser, identifier, +=09=09=09=09 enum_type, +=09=09=09=09 /*is_template=3D*/false, +=09=09=09=09 /*is_namespace=3D*/false, +=09=09=09=09 /*check_dependency=3D*/true, +=09=09=09=09 /*ambiguous_decls=3D*/NULL, +=09=09=09=09 input_location); if (name && name !=3D error_mark_node) =09{ =09 type =3D TREE_TYPE (name); @@ -19142,21 +19140,20 @@ cp_parser_enum_specifier (cp_parser* par =09{ =09 cp_parser_error (parser, "expected %<{%>"); =09 if (has_underlying_type) -=09 { -=09 type =3D NULL_TREE; -=09 goto out; -=09 } +=09 return NULL_TREE; =09} /* An opaque-enum-specifier must have a ';' here. */ if ((scoped_enum_p || underlying_type) =09 && cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON)) =09{ -=09 cp_parser_error (parser, "expected %<;%> or %<{%>"); =09 if (has_underlying_type) =09 { -=09 type =3D NULL_TREE; -=09 goto out; +=09 error_at (cp_lexer_peek_token (parser->lexer)->location, +=09=09=09"expected %<;%> or %<{%>"); +=09 return NULL_TREE; =09 } +=09 else +=09 cp_parser_error (parser, "expected %<;%> or %<{%>"); =09} } =20 @@ -19172,9 +19169,7 @@ cp_parser_enum_specifier (cp_parser* par =09 push_scope (nested_name_specifier); =09} else if (TREE_CODE (nested_name_specifier) =3D=3D NAMESPACE_DECL) -=09{ -=09 push_nested_namespace (nested_name_specifier); -=09} +=09push_nested_namespace (nested_name_specifier); } =20 /* Issue an error message if type-definitions are forbidden here. */ @@ -19334,12 +19329,8 @@ cp_parser_enum_specifier (cp_parser* par =09 pop_scope (nested_name_specifier); =09} else if (TREE_CODE (nested_name_specifier) =3D=3D NAMESPACE_DECL) -=09{ -=09 pop_nested_namespace (nested_name_specifier); -=09} +=09pop_nested_namespace (nested_name_specifier); } - out: - parser->colon_corrects_to_scope_p =3D saved_colon_corrects_to_scope_p; return type; } =20 --- gcc/testsuite/g++.dg/cpp0x/enum40.C.jj=092020-03-15 22:35:43.413297557 = +0100 +++ gcc/testsuite/g++.dg/cpp0x/enum40.C=092020-03-15 22:35:43.413297557 +01= 00 @@ -0,0 +1,26 @@ +// PR c++/90995 +// { dg-do compile { target c++11 } } + +void +foo () +{ + enum : int a alignas;=09=09// { dg-error "expected" } +} + +void +bar () +{ + enum : int a;=09=09=09// { dg-error "expected" } +} + +void +baz () +{ + enum class a : int b alignas;=09// { dg-error "expected" } +} + +void +qux () +{ + enum class a : int b;=09=09// { dg-error "expected" } +} =09Jakub