From patchwork Fri Jun 16 11:58:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Coplan X-Patchwork-Id: 1795886 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=uFGdz2SO; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QjHks0c06z20X8 for ; Fri, 16 Jun 2023 21:59:17 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 07C453857B98 for ; Fri, 16 Jun 2023 11:59:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 07C453857B98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686916755; bh=HZND6R+VNFSa3/jQjczbNHNhy3adS+XtXeEQGsZ1z7s=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=uFGdz2SO/pJ6HLXKD6HThkHeoy3a4/jou/NRxYxlL038Bw9ktrAU5TTpKyaihJy5R fjTWTvqeliqFldi5i5VQPYGQlxi5Z68QkiG7TdQtWd7x9E5787M+fGziTMnhe3StEG 7uY2+fqVfS69tKPuV8xf8nrbvtueAbVm/Dob4NqA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2047.outbound.protection.outlook.com [40.107.21.47]) by sourceware.org (Postfix) with ESMTPS id 27AFB3858D35 for ; Fri, 16 Jun 2023 11:58:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 27AFB3858D35 Received: from DU2P251CA0003.EURP251.PROD.OUTLOOK.COM (2603:10a6:10:230::13) by AS2PR08MB8832.eurprd08.prod.outlook.com (2603:10a6:20b:5e6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.25; Fri, 16 Jun 2023 11:58:49 +0000 Received: from DBAEUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:230:cafe::4) by DU2P251CA0003.outlook.office365.com (2603:10a6:10:230::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.38 via Frontend Transport; Fri, 16 Jun 2023 11:58:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT043.mail.protection.outlook.com (100.127.143.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.13 via Frontend Transport; Fri, 16 Jun 2023 11:58:49 +0000 Received: ("Tessian outbound 5154e9d36775:v136"); Fri, 16 Jun 2023 11:58:49 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c60b3394200583d6 X-CR-MTA-TID: 64aa7808 Received: from 1a7c35d0e820.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id DE53C2BF-6233-4FA4-BA82-FCDD89EC2CF5.1; Fri, 16 Jun 2023 11:58:42 +0000 Received: from EUR02-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1a7c35d0e820.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 16 Jun 2023 11:58:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S9k4d/tc/BlYKmXQ/V0KyfINbxW/KnunoLug7ih8jGVECNJnm/5VkIIV48LbK5utPSx7h9ESg7fJHm6QozXkpsVDtoeNmLP6F+BmN+YdA0unwXXMmhEx3+OBB7SLsCAtSaaLLK28vrgyeTrLU6g2e06uDYu4rRxV05fwb6mNIjBA9d30FMlmHtQEMJOl+6wKQpdXfxu20S6XdFseJybvqLpn1sANSH5QazuY3EIMh7/eKGq1lEe7k/U8Gj42jOdwwSYw5elSpejN1CQyx/vUJGZPTkc8nsQhjNL+y6V79bnO9Ed+/0t5reEB9m3Sox/VdkfBr3FbSGoGxhG10nBQvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HZND6R+VNFSa3/jQjczbNHNhy3adS+XtXeEQGsZ1z7s=; b=BWB1mO6zWTpJmfLo04XB1jCovj0jWbmnoMIyjw/y6HZVASMaMAQTNgFtaz25O9f1ou+Ja7tW8ODTuF8+VYS8TJrGd+diN/aJ9hIaj+qOiWHwEXN/KlyxcrgKH2SevJubmHUdjmX5HeeZ9ZgOSucVQ/Ged+vQoclxyyR5Lq7rsU0kmZRea6LgvErtcoVVvRLkRn5UVFRbCffO91zP2RrFebbrTaiMd+RgTYwj/b4ypm9EWr9XJU5jopNTQr4vj8tjbFyIbSs7PTjUrNhAJdBahh11mg1f3r2VjvbiswcHmPZYoGqnaqUIdkDvVeby7v8ZIXZkcUcbFSy591xBMaunpw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) by DBAPR08MB5605.eurprd08.prod.outlook.com (2603:10a6:10:1af::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.25; Fri, 16 Jun 2023 11:58:39 +0000 Received: from PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::202a:45b7:3be8:47d5]) by PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::202a:45b7:3be8:47d5%6]) with mapi id 15.20.6477.037; Fri, 16 Jun 2023 11:58:38 +0000 Date: Fri, 16 Jun 2023 12:58:34 +0100 To: gcc-patches@gcc.gnu.org Cc: Jason Merrill , Nathan Sidwell , Iain Sandoe Subject: [PATCH v3] c++: Accept elaborated-enum-base with pedwarn Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO4P123CA0662.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:316::18) To PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAWPR08MB8958:EE_|DBAPR08MB5605:EE_|DBAEUR03FT043:EE_|AS2PR08MB8832:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c9778ef-3916-4b4e-0183-08db6e610c1e x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: lnMDLKzYfewFZK/WgDbNPRqAcZBEddR7O+MOWWIHW+cJOnqcAZlM43GVFEHj+nhyl2GaIH3fssWaNmS/qMWzXNIU1zUQy3Dgf8Fls4LGrjMmsxceZjTCD6j3T9mMG4xMH5ob8i8oorn0N2iGOyhjdctQEjx9KkB+I0IcVrRjQz5GK6vr5pIs1kmM+EsVpuuQH1v16as9o/g9AhUE5/W6YodTIa6u5KSvIilsOgRonddzfT8lFHqUjr6HZB/i6D93nl+XaCjySRbZ9MEfXMhedKlr3IuhxxOYCvODCfsNhgq0iPrFouurkQZ4Ka6hmCKGRgVRBuZEcj3xY2jYn39sAx/tCsugU15yQTmVPahHovhVNHkL7JBqbRbzrGGXG78Om3zdPnwiMkpaAdLF7No3tJqvBWZUL9YjFOhMleFvZmMeot1Kc6AA9UxD9IZTZwHIJCjK/wxU/DwIDm+v5EuZDUYqrjd1qXu8plQWM4z8B66XwwC7B5GKm66wtvQZO+7lAb8YriQWhj71/C/XT21YPYusIDvC+RHWPyjP35ycq0lJH3ERfdtSMml/sNO2hLqahq6krPosn/4hJah9Xhjlzmt0xqJtZfto750gins772cebpVBQw51+rPlzSOtvAhkgtdUCL1DHtMg3/yvOaQ5zw== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAWPR08MB8958.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(346002)(39860400002)(396003)(366004)(376002)(136003)(451199021)(54906003)(33964004)(44144004)(41300700001)(86362001)(66556008)(66946007)(6486002)(6916009)(8936002)(8676002)(6666004)(66476007)(316002)(36756003)(4326008)(478600001)(6512007)(44832011)(235185007)(5660300002)(966005)(26005)(83380400001)(6506007)(186003)(21480400003)(2906002)(38100700002)(2616005)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR08MB5605 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT043.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 23dde845-6c27-48aa-fdc6-08db6e61052f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +JD7gPQuHPSql/siT0wdpHuxApVQdR5W11M2xbCGP4nWg2HXOYmNOxTrMYz9d8vVkx/MTL7RDp9x9UtfjiQtbQEeGzPtQafULc9njQc2sNa73NLMoxBufQidZ6DZ4h0BhZKblJbzcQGo7l2B2EESAw5YDIkYc6fS0uCVkUkx5J6ijvuvSJ2dDkPK8Qk/eU9hd9/di1RGm5WqQCdVHotsMhaY/lpAbPamV6SmbhIcr/Sjqp3BLILtUzWCFmFPQmvXGfJ4MeIBIH5yQTXdBIj4wd4qjvaPfimZOuJzEoaIDxTnkmpQMY8vusuXXFUNSwofrry2pUwf8fZmqiG6B5qmfCEdRAQe7s5DjttfhcdogOvZK+y6q/P5BhfigWV96LWS6oKMomvm314YCPBr2vqviArt9bRwnNBv6K8TAqpXsiYYHWXvGFo/2to116SVaZ8n+FcCBtvVKz0oojQxu6pA1aYkbcCIYpcvDGwu0ey4p2fZIOALsFNl3fsaky3Wqj+/zBKkN5BkUodA3eIeUKB+IlwL3n1dqqdXkEZWhoYGmqD+7z+uTAl5FiFyAOjO0Cy7bkxMoi4jDT9ThSw3Cha43aL+R7DbhKJuMXr0VcH/OOKPFecz2Qod9nOf8sD2QcloYucMoSCo7pnqxOlNhr5+yZ7ZoWWcBR06C2u006TBL4wxkg4sV8vkzzredBWejm/GTief5m90utczXn4kgzONfi1TXhPaJK0odj3HnkB3Y27/7U8VDDQ3IM7kvnVJDpg4X2/dbp0onFze7dmIMmQYfSqPC+v2YnrY26Uk8ZDVtSE= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(396003)(346002)(136003)(376002)(451199021)(36840700001)(40470700004)(46966006)(966005)(54906003)(4326008)(86362001)(70206006)(6916009)(70586007)(6666004)(44144004)(33964004)(8936002)(8676002)(6486002)(41300700001)(316002)(36756003)(235185007)(6506007)(5660300002)(107886003)(356005)(82740400003)(478600001)(82310400005)(26005)(6512007)(44832011)(81166007)(2906002)(186003)(2616005)(21480400003)(83380400001)(336012)(40460700003)(36860700001)(47076005)(40480700001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 11:58:49.7233 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c9778ef-3916-4b4e-0183-08db6e610c1e X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT043.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB8832 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alex Coplan via Gcc-patches From: Alex Coplan Reply-To: Alex Coplan Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, This is a v3 patch addressing feedback for: https://gcc.gnu.org/pipermail/gcc-patches/2023-June/621714.html The only change since the previous version is that the new option is documented in invoke.texi (and the description in c.opt was shortened as requested). ------ macOS SDK headers using the CF_ENUM macro can expand to invalid C++ code of the form: typedef enum T : BaseType T; i.e. an elaborated-type-specifier with an additional enum-base. Upstream LLVM can be made to accept the above construct with -Wno-error=elaborated-enum-base. This patch adds the -Welaborated-enum-base warning to GCC and adjusts the C++ parser to emit this warning instead of rejecting this code outright. The macro expansion in the macOS headers occurs in the case that the compiler declares support for enums with underlying type using __has_feature, see https://gcc.gnu.org/pipermail/gcc-patches/2023-May/618450.html GCC rejecting this construct outright means that GCC fails to bootstrap on Darwin in the case that it (correctly) implements __has_feature and declares support for C++ enums with underlying type. With this patch, GCC can bootstrap on Darwin in combination with the (WIP) __has_feature patch posted at: https://gcc.gnu.org/pipermail/gcc-patches/2023-May/617878.html Bootstrapped/regtested on aarch64-linux-gnu and x86_64-apple-darwin. OK for trunk? Thanks, Alex gcc/c-family/ChangeLog: * c.opt (Welaborated-enum-base): New. gcc/ChangeLog: * doc/invoke.texi: Document -Welaborated-enum-base. gcc/cp/ChangeLog: * parser.cc (cp_parser_enum_specifier): Don't reject elaborated-type-specifier with enum-base, instead emit new Welaborated-enum-base warning. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/enum40.C: Adjust expected diagnostics. * g++.dg/cpp0x/forw_enum6.C: Likewise. * g++.dg/cpp0x/elab-enum-base.C: New test. diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index cead1995561..0930a3c0422 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -1488,6 +1488,10 @@ Wsubobject-linkage C++ ObjC++ Var(warn_subobject_linkage) Warning Init(1) Warn if a class type has a base or a field whose type uses the anonymous namespace or depends on a type with no linkage. +Welaborated-enum-base +C++ ObjC++ Var(warn_elaborated_enum_base) Warning Init(1) +Warn if an additional enum-base is used in an elaborated-type-specifier. + Wduplicate-decl-specifier C ObjC Var(warn_duplicate_decl_specifier) Warning LangEnabledBy(C ObjC,Wall) Warn when a declaration has duplicate const, volatile, restrict or _Atomic specifier. diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index d77fbd20e56..4dd290717de 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -21024,11 +21024,13 @@ cp_parser_enum_specifier (cp_parser* parser) /* Check for the `:' that denotes a specified underlying type in C++0x. Note that a ':' could also indicate a bitfield width, however. */ + location_t colon_loc = UNKNOWN_LOCATION; if (cp_lexer_next_token_is (parser->lexer, CPP_COLON)) { cp_decl_specifier_seq type_specifiers; /* Consume the `:'. */ + colon_loc = cp_lexer_peek_token (parser->lexer)->location; cp_lexer_consume_token (parser->lexer); auto tdf @@ -21077,10 +21079,13 @@ cp_parser_enum_specifier (cp_parser* parser) && cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON)) { if (has_underlying_type) - cp_parser_commit_to_tentative_parse (parser); - cp_parser_error (parser, "expected %<;%> or %<{%>"); - if (has_underlying_type) - return error_mark_node; + pedwarn (colon_loc, + OPT_Welaborated_enum_base, + "declaration of enumeration with " + "fixed underlying type and no enumerator list is " + "only permitted as a standalone declaration"); + else + cp_parser_error (parser, "expected %<;%> or %<{%>"); } } diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 6d08229ce40..8ee5ba15709 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -254,7 +254,8 @@ in the following sections. -Wdelete-non-virtual-dtor -Wno-deprecated-array-compare -Wdeprecated-copy -Wdeprecated-copy-dtor -Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion --Weffc++ -Wno-exceptions -Wextra-semi -Wno-inaccessible-base +-Weffc++ -Wno-elaborated-enum-base +-Wno-exceptions -Wextra-semi -Wno-inaccessible-base -Wno-inherited-variadic-ctor -Wno-init-list-lifetime -Winvalid-constexpr -Winvalid-imported-macros -Wno-invalid-offsetof -Wno-literal-suffix @@ -3846,6 +3847,15 @@ bool b = e <= 3.7; @option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled by @option{-Wenum-conversion}. +@opindex Welaborated-enum-base +@opindex Wno-elaborated-enum-base +@item -Wno-elaborated-enum-base +For C++11 and above, warn if an (invalid) additional enum-base is used +in an elaborated-type-specifier. That is, if an enum with given +underlying type and no enumerator list is used in a declaration other +than just a standalone declaration of the enum. Enabled by default. This +warning is upgraded to an error with -pedantic-errors. + @opindex Winit-list-lifetime @opindex Wno-init-list-lifetime @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)} @@ -6055,6 +6065,7 @@ errors by @option{-pedantic-errors}. For instance: -Wchanges-meaning @r{(C++)} -Wcomma-subscript @r{(C++23 or later)} -Wdeclaration-after-statement @r{(C90 or earlier)} +-Welaborated-enum-base @r{(C++11 or later)} -Wimplicit-int @r{(C99 or later)} -Wimplicit-function-declaration @r{(C99 or later)} -Wincompatible-pointer-types diff --git a/gcc/testsuite/g++.dg/cpp0x/elab-enum-base.C b/gcc/testsuite/g++.dg/cpp0x/elab-enum-base.C new file mode 100644 index 00000000000..57141f013bd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/elab-enum-base.C @@ -0,0 +1,7 @@ +// { dg-do compile { target c++11 } } +// { dg-options "" } +// Empty dg-options to override -pedantic-errors. + +typedef long CFIndex; +typedef enum CFComparisonResult : CFIndex CFComparisonResult; +// { dg-warning "declaration of enumeration with fixed underlying type" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/g++.dg/cpp0x/enum40.C b/gcc/testsuite/g++.dg/cpp0x/enum40.C index cfdf2a4a18a..d3ffeb62d70 100644 --- a/gcc/testsuite/g++.dg/cpp0x/enum40.C +++ b/gcc/testsuite/g++.dg/cpp0x/enum40.C @@ -4,23 +4,25 @@ void foo () { - enum : int a alignas; // { dg-error "expected" } + enum : int a alignas; // { dg-error "declaration of enum" } + // { dg-error {expected '\(' before ';'} "" { target *-*-* } .-1 } } void bar () { - enum : int a; // { dg-error "expected" } + enum : int a; // { dg-error "declaration of enum" } } void baz () { - enum class a : int b alignas; // { dg-error "expected" } + enum class a : int b alignas; // { dg-error "declaration of enum" } + // { dg-error {expected '\(' before ';'} "" { target *-*-* } .-1 } } void qux () { - enum class a : int b; // { dg-error "expected" } + enum class a : int b; // { dg-error "declaration of enum" } } diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum6.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum6.C index 01bf563bcdd..8ad3f733292 100644 --- a/gcc/testsuite/g++.dg/cpp0x/forw_enum6.C +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum6.C @@ -23,7 +23,7 @@ enum class E7 : int; //ok enum class E3 e3; // { dg-error "scoped enum must not use" } enum struct E3 e4; // { dg-error "scoped enum must not use" } -enum E5 : int e5; // { dg-error "expected|invalid type" } +enum E5 : int e5; // { dg-error "declaration of enumeration with fixed underlying type|invalid type" } enum E6 : int { a, b, c }; // { dg-message "previous definition" } enum E6 : int { a, b, c }; // { dg-error "multiple definition" }