From patchwork Wed Aug 10 22:39:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 657963 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3s8mLG3Hbwz9sf9 for ; Thu, 11 Aug 2016 08:39:48 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=xDX2y0il; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; q=dns; s=default; b=xZbgzUT3b5Ri4Wy d9RQQOHBznigkOoDTsfjAIDH/stHYk4oq/Az5ZApNdiEHLb8pfKN0bOThPCTLtvD sdg7rtus7h3FVNUDx0nmlJs692WQhrkldZnhujiIP2kMF8fak/udVEqh5jwTVkXS 1mLDpM820ix0wHyJNaa2HTweponc= 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 :mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; s=default; bh=mOxCw2ys7xceLQ5jb42fB 58RhF0=; b=xDX2y0ilgMT029kprUU+VY/KMTFAh0Evm1RsfLwpGnvfQbYdVaRdw IDR8vwVuYPWyMM7eVwPmZmlY3qkw8rzRmzGJEpB6VnrLWwVpah0kYa1XsKt0lGzE tOhIMMll6m/pUJOtLodJ0GvS0QrYpGRylCMWDlhEYRwdNEn1WkldUk= Received: (qmail 123592 invoked by alias); 10 Aug 2016 22:39:40 -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 123562 invoked by uid 89); 10 Aug 2016 22:39:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.8 required=5.0 tests=AWL, BAYES_00, MSWORD_ATTACHED, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=cpp_reader, *pfile, 3446 X-HELO: mail-oi0-f41.google.com Received: from mail-oi0-f41.google.com (HELO mail-oi0-f41.google.com) (209.85.218.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 10 Aug 2016 22:39:33 +0000 Received: by mail-oi0-f41.google.com with SMTP id c15so79058435oig.0 for ; Wed, 10 Aug 2016 15:39:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=PXM1gNX4z6v+LfA7vCJqdd10sfa8Ve6VlOE3yJ/fwF4=; b=lejWn1qgd6YerYw4Meig6JU6AxOMZa0r/9oVIvx48ih7svf8bdblnzjl9eX88HyH6S loUZLOvtSikFdellCP9DQjl3V565nEIEGvrgk5BtRIgueye0QWSkApUgaEP2P0Mc6oDg rbRBPWffrAzwuqj7sGvFEHGxrrH0+e83UBpcZm1b2khmar61H5BoWU4FwBPbC2vJY5a5 Hz/BWUX0JDF0ivBANqn0HNlD1mqdWhy0fjjvf7yqJ+TqLDG+7JdZPyM1CwaKvnpkkgvv GmtVsQazNMZr5BkMl+th3WIufzgLS8OjSTXOucj27DrWcSF+3fWO29fki6m8bASE/kb3 sNxA== X-Gm-Message-State: AEkoousx5SOm5jLs3Zs0XYymaYUeh9GIpbXn3XYy6Orm2e0fFf2KjE1upGsASnIZbdUlSKtA9Ykh3qb3KGs4LiBQ X-Received: by 10.157.7.137 with SMTP id 9mr92635oto.155.1470868771377; Wed, 10 Aug 2016 15:39:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.105.169 with HTTP; Wed, 10 Aug 2016 15:39:10 -0700 (PDT) In-Reply-To: References: From: Jason Merrill Date: Wed, 10 Aug 2016 18:39:10 -0400 Message-ID: Subject: Re: C++ PATCH for C++17 constexpr if To: gcc-patches List Cc: Ville Voutilainen X-IsSubscribed: yes On Wed, Aug 10, 2016 at 5:57 PM, Jason Merrill wrote: > This patch implements the C++17 constexpr if feature. The primary use > is in templates, where the non-taken branch of the constexpr > if-statement is not instantiated. But it can also be used outside of > templates, where the branches are parsed and discarded, and discarded > return statements are not used for return type deduction. ...and the feature test macro. commit 1f20a739d61ef839ec7091aa1278adf6d726ead4 Author: Jason Merrill Date: Wed Aug 10 18:35:01 2016 -0400 * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_if_constexpr. diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index 46c70ac..82ed19d 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -882,6 +882,7 @@ c_cpp_builtins (cpp_reader *pfile) cpp_define (pfile, "__cpp_nontype_template_args=201411"); cpp_define (pfile, "__cpp_range_based_for=201603"); cpp_define (pfile, "__cpp_constexpr=201603"); + cpp_define (pfile, "__cpp_if_constexpr=201606"); } if (flag_concepts) /* Use a value smaller than the 201507 specified in diff --git a/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C b/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C index f5ed6ab..41b6111 100644 --- a/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C +++ b/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C @@ -344,6 +344,12 @@ # error "__cpp_hex_float != 201603" #endif +#ifndef __cpp_if_constexpr +# error "__cpp_if_constexpr" +#elif __cpp_if_constexpr != 201606 +# error "__cpp_if_constexpr != 201606" +#endif + #ifdef __has_cpp_attribute # if ! __has_cpp_attribute(maybe_unused)