From patchwork Fri Aug 16 20:41:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 1148458 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-507150-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="fN9z4kji"; 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 469FbK0M2yz9sNC for ; Sat, 17 Aug 2019 06:41:15 +1000 (AEST) 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=HTA+GtiAuUTPBEMi+ueNxiJlavoZ+B/FjwzBFmX/G1r5zIjYWPhhp rsEXn8pBYfaiE0WKnUXn/Quol0wF15RmWCkiWTK4oq/yULBX6BE5EGnRNPL8m0fI Q8apVi9DnKjOwIYaxt4IaksWg0rPFabR8aXZ5gy1AaPacP2iMoqC2s= 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=6JY0kDHOV/iiYg1JKy+VGPP0lHM=; b=fN9z4kjiggPgasTjVVfp TzhSTNQ8cDi4MrzxqXVgyKds3Wv9/v+H+2KPUpsS1szkLf49QSMN8n5IdZptdmou dBR8YUfC5dgVouy0LCR95pdeLdQ35XFRSjf5Evufd5pVg/XGAwaNiy9t434rhim0 oFcFTIGxzQazvG08212zC3I= Received: (qmail 72709 invoked by alias); 16 Aug 2019 20:41:07 -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 72656 invoked by uid 89); 16 Aug 2019 20:41:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, SPF_HELO_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; Fri, 16 Aug 2019 20:41:05 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 325B55946B for ; Fri, 16 Aug 2019 20:41:04 +0000 (UTC) Received: from redhat.com (ovpn-122-82.rdu2.redhat.com [10.10.122.82]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB54910016EB for ; Fri, 16 Aug 2019 20:41:03 +0000 (UTC) Date: Fri, 16 Aug 2019 16:41:01 -0400 From: Marek Polacek To: GCC Patches Subject: C++ PATCH to add test for c++/85827 Message-ID: <20190816204101.GU14737@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.12.1 (2019-06-15) This one was fixed in r269433 Tested on x86_64-linux, applying to trunk. 2019-08-16 Marek Polacek PR c++/85827 * g++.dg/cpp1z/constexpr-if29.C: New test. diff --git gcc/testsuite/g++.dg/cpp1z/constexpr-if29.C gcc/testsuite/g++.dg/cpp1z/constexpr-if29.C new file mode 100644 index 00000000000..a40912a6fa5 --- /dev/null +++ gcc/testsuite/g++.dg/cpp1z/constexpr-if29.C @@ -0,0 +1,28 @@ +// PR c++/85827 +// { dg-do compile { target c++17 } } +// { dg-options "-Wunused-variable -Wunused-parameter" } + +template int f() +{ + constexpr bool _1 = N == 1; + constexpr bool _2 = N == 2; + constexpr bool _3 = N == 3; + + if constexpr (_1) { + return 5; + } else if constexpr (_2) { + return 1; + } else if constexpr (_3) { + return 7; + } +} + +int a() { + return f<1>(); +} +int b() { + return f<2>(); +} +int c() { + return f<3>(); +}