From patchwork Sat Dec 1 22:01:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 1006433 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-491449-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="kn/wwQ7D"; 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 436lZp5vlNz9sB7 for ; Sun, 2 Dec 2018 09:01:22 +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=MYtPZE08SV9JZJNHhvleM1GBllJHqmlFk90y/A/hN9ulbKUvCtcBH dG5zkIfhjoCM9dsZNxniPcESsiqaR+cncECzodJpTKQIw6LzwzoXkj2QBcu+pRBZ CcuEzwhuABzTcA2W9vjhJxSHOOhZHHInDZFUJtG2+rnRyu4+ILo41k= 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=YY29v5SatcQnpkx/mKCUHiuO0uo=; b=kn/wwQ7DhJwVMUsp8yI8 7oUeswDqaU4Vxw78LG6o0Tcvp0Ch0AT/PL4Pan5Vr+D1OOq/crw6FaQWfXMcxl+N eo32Z0IUrRPajykr9D81hS+odF+iFuCNiyC4n4j2ZasJ6uDFH/nrrcKGP3xpwJRk vByB8c6R4pKMEE41yZZ7JAc= Received: (qmail 38856 invoked by alias); 1 Dec 2018 22:01:05 -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 37216 invoked by uid 89); 1 Dec 2018 22:01:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=sk:polacek, polacekredhatcom, U*polacek, applying 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; Sat, 01 Dec 2018 22:01:00 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6555E4E93E for ; Sat, 1 Dec 2018 22:00:59 +0000 (UTC) Received: from redhat.com (ovpn-125-91.rdu2.redhat.com [10.10.125.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B9F5660BE7 for ; Sat, 1 Dec 2018 22:00:58 +0000 (UTC) Date: Sat, 1 Dec 2018 17:01:06 -0500 From: Marek Polacek To: GCC Patches Subject: [committed] C++ PATCH to add test for c++/87523 Message-ID: <20181201220106.GD21364@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Tested x86_64-linux, applying to trunk. 2018-12-01 Marek Polacek PR c++/87523 * g++.dg/cpp1y/lambda-generic-87523.C: New test. diff --git gcc/testsuite/g++.dg/cpp1y/lambda-generic-87523.C gcc/testsuite/g++.dg/cpp1y/lambda-generic-87523.C new file mode 100644 index 00000000000..ecba1cfc322 --- /dev/null +++ gcc/testsuite/g++.dg/cpp1y/lambda-generic-87523.C @@ -0,0 +1,32 @@ +// PR c++/87523 +// { dg-do compile { target c++14 } } + +template +struct my_integer_constant { + constexpr my_integer_constant() {} + constexpr operator T() const { return v; } + constexpr T operator()() const { return v; } +}; + +template +struct constant_call { + template + static void call(T v, Callback f) { + char dummy[sizeof...(u)] = { ( (v == u) ? (f(my_integer_constant{}), static_cast(0)) : static_cast(0))... }; + (void)dummy; + } +}; + +void f(bool reverse_in, bool other_bool_in) { + auto helper = [&] (auto reverse_t) { + bool constexpr reverse_v = reverse_t; + (void)reverse_v; + constant_call::call(other_bool_in, + [&] (auto newb) { + bool reverse_v_dyn = reverse_v; + }); + }; + constant_call::call(reverse_in, [&] (auto reverse_t) { + helper(reverse_t); + }); +}