From patchwork Tue Oct 8 16:25:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 1173421 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-510478-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="aetaDQHp"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46njQ50Ts1z9sN1 for ; Wed, 9 Oct 2019 03:25:47 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=CqIAOPMpEFykR8aNqMUcbK8si+ZM/yG7U29D2w+yVbuBTkwWAvyer erZF9PMMoU621B7Mbuv0BR6Uwc5GqD7mOk4LQXXJSQb9Ff7CerHUZN83lDMTI29T ckrruF5YY6L+EYhsFwD15tWBX8of6I+VRWHpxx6/r/t3LbCaEGH3SE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=SMGdckjDwX+gO7edVmoeM1Fw4E0=; b=aetaDQHp/PAN8r8pZ+Oc Yx3x8N3qXSNGqSmhwBo6PVD5VsLIr33TdopMzEtt0VKf4K01YqtEIJOXykQUM7yU cbbrGMma6MzR6nOJC2mYDHE9/pyHQdgwl9d6HZtbdQWLfxKH+TZwVRL5ik+ypvC1 0pU3qRdwRboPP8z0s4sN3ak= Received: (qmail 29522 invoked by alias); 8 Oct 2019 16:25:39 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 29513 invoked by uid 89); 8 Oct 2019 16:25:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 08 Oct 2019 16:25:37 +0000 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2AB4F30917AA for ; Tue, 8 Oct 2019 16:25:36 +0000 (UTC) Received: from redhat.com (ovpn-122-104.rdu2.redhat.com [10.10.122.104]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8D3C619481; Tue, 8 Oct 2019 16:25:35 +0000 (UTC) Date: Tue, 8 Oct 2019 12:25:33 -0400 From: Marek Polacek To: GCC Patches , Jason Merrill Subject: C++ PATCH to add test for DR 685 Message-ID: <20191008162533.GA2954@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.12.1 (2019-06-15) I noticed we've fixed this DR already. It added [conv.prom]/4 and type_promotes_to implements it: /* ISO C++17, 7.6/4. A prvalue of an unscoped enumeration type whose underlying type is fixed (10.2) can be converted to a prvalue of its underlying type. Moreover, if integral promotion can be applied to its underlying type, a prvalue of an unscoped enumeration type whose underlying type is fixed can also be converted to a prvalue of the promoted underlying type. */ Tested on x86_64-linux, applying to trunk. 2019-10-08 Marek Polacek DR 685 - Integral promotion of enum ignores fixed underlying type. * g++.dg/cpp0x/scoped_enum9.C: New test. diff --git gcc/testsuite/g++.dg/cpp0x/scoped_enum9.C gcc/testsuite/g++.dg/cpp0x/scoped_enum9.C new file mode 100644 index 00000000000..f38f26dc35b --- /dev/null +++ gcc/testsuite/g++.dg/cpp0x/scoped_enum9.C @@ -0,0 +1,11 @@ +// DR 685 - Integral promotion of enumeration ignores fixed underlying type. +// { dg-do compile { target c++11 } } + +enum E: long { e }; + +void f(int); +int f(long); + +void g() { + int k = f(e); +}