From patchwork Wed Jan 2 16:56:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 1020031 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-493287-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="aQZ/EBw7"; 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 43VHJ918j8z9s4s for ; Thu, 3 Jan 2019 03:56:23 +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=boCwIgJRm22Lb2QSzcs4w8VMOfAPOJmaZQC+8QRkC/V8LuT+r9hbG 7/v+CDDzASyyb8Gn2Ab/mmIa0xP8E3bRLlacIjbJWF4uvMAgvA7Jz0NlgYfhrRDw gppc0swUkjShlZeEYRUP/mD0+rHdy+rhprABUV4doy0W3WNjlH4jEo= 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=YEbLncZtT/rFjwnrATwwG9Bbg8I=; b=aQZ/EBw7ucCintcG16Me 7xTy+Vi9dDfujDmL5jQd5Fa3xwqn1vnGX1SyJvFIOMcnAKcats/T+Fdb+SL6n/ep IEoUkWRrpHIPPlOpRf4yy6WNUGWH9L+SM6tkXX3g2DQReLCMuxuF9rPLPK2hlBLd bzVeJY0fvETEDvvm6qqOB1c= Received: (qmail 117446 invoked by alias); 2 Jan 2019 16:56:14 -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 117396 invoked by uid 89); 2 Jan 2019 16:56:14 -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= 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; Wed, 02 Jan 2019 16:56:13 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6CFFA7AEAD for ; Wed, 2 Jan 2019 16:56:12 +0000 (UTC) Received: from redhat.com (ovpn-124-58.rdu2.redhat.com [10.10.124.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 19BFB6012C for ; Wed, 2 Jan 2019 16:56:11 +0000 (UTC) Date: Wed, 2 Jan 2019 11:56:23 -0500 From: Marek Polacek To: GCC Patches Subject: C++ PATCH to add test for c++/86875 Message-ID: <20190102165623.GX21364@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) The testcase in this PR was fixed by r267272, so I've reduced it and am going to add it to the testsuite. Tested on x86_64-linux (and with -m32), applying onto trunk. 2019-01-02 Marek Polacek PR c++/86875 * g++.dg/cpp1y/lambda-generic-86875.C: New test. diff --git gcc/testsuite/g++.dg/cpp1y/lambda-generic-86875.C gcc/testsuite/g++.dg/cpp1y/lambda-generic-86875.C new file mode 100644 index 00000000000..3a81b00df96 --- /dev/null +++ gcc/testsuite/g++.dg/cpp1y/lambda-generic-86875.C @@ -0,0 +1,21 @@ +// PR c++/86875 +// { dg-do compile { target c++14 } } + +template using decay_t = _Tp; +template class A { + Fun fun_; + +public: + template A(T p1) : fun_(p1) {} + auto operator()() { fun_(this); } +}; + +template auto y_combinator(Fun p1) { return A>(p1); } + +int +main() +{ + const unsigned int w = 1; + auto foo = y_combinator([=](auto) { auto i = +w; }); + foo(); +}