From patchwork Thu Apr 5 14:47:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 895416 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-475933-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="JCPoJMuE"; 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 40H5LT4rKSz9s0y for ; Fri, 6 Apr 2018 00:48:47 +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 :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=xRgj2kkW4mHpcQs8CRqUWy/f2ccd4K7lV1EZIm1jaRDdnQ Jf9vM8BVxEsytv2mWra/DXYbYcI0uRMN+wK5j0kw14d8iTuY7AP2xgQ04kC7ZYhC czVXavxRBD4aEE8GFMIqxHlpLFxkfEkXSdSnqA7KmH9iX+joRD582tySKTDWs= 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:from:date:message-id:subject:to:content-type; s= default; bh=z3WYDSUL1dwtFtAB/dDzunVMBCI=; b=JCPoJMuEJ2ZB8zRSlGW+ sUETV8CqXXHStsBwlWYfygcNT90Of1GyTSBifrsByyTFkum+tRQ/N3PzPfxeIPFC yrU88B/Hx3R7CDaiy9+xpV/r1LeH1wIG0U0tKwFPGbpB67QZ7ievBGBvuhrFqTho hrgp6G9xdhUER6MYGAXoEaY= Received: (qmail 80884 invoked by alias); 5 Apr 2018 14:48: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 71843 invoked by uid 89); 5 Apr 2018 14:48:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy= X-HELO: mail-ot0-f180.google.com Received: from mail-ot0-f180.google.com (HELO mail-ot0-f180.google.com) (74.125.82.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Apr 2018 14:48:18 +0000 Received: by mail-ot0-f180.google.com with SMTP id y46-v6so27481890otd.4 for ; Thu, 05 Apr 2018 07:48:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=QCBz/QBaLsSDL3WqmP1oC+6uQVMjAxZgtnk8zAmhsKc=; b=YvpOSxDTzwCn1284JleC6pT/5obgpXXx2dsH3fAzXXVHohbpl/TjuI6QcAX1Sbq5pk s9uoTGCjaPbmWzdWTdguSvbtGGlfJBAUDFDF80UzfJaLkqGSGGggAmjf6BXOd+EWeo5m T72nzSM54OlbFGmi0/v9vpGeBHrfE7XJevA26p4HtjUcIBvGgdjtvItnkDXeor7TiVvC RfYTE4pOxucCS0IatOIZsBS2UOKQDZ2aNm+Beygt1Kj563oEFQ7xzaMr9GBuWdnsSzZj ePBtJJQ9aiQxzu9j0h8VjeeVC9+OUfTsEZq35r4eNme1e1KZGgnnNtc+EiQX4UQmn7D9 Xehw== X-Gm-Message-State: AElRT7GoIHmERRfGZlK/WiTBWw1RvaCzUG0PJJwa2X5SiHBtRHfEdnzK 5+eKOPKQuBLwc0AxGcvUQVfIHROnFfz2xG2JXyifyEx3 X-Google-Smtp-Source: AIpwx4/DqG1Ye6y7XRW9hbOho6nNNY+cdF3QL+trXz75P3LLF3DVg9SqPC8hVxR2sU+cx8BzwO3eNkRRu3I8HpEMhy8= X-Received: by 2002:a9d:4c86:: with SMTP id m6-v6mr12703813otf.122.1522939685943; Thu, 05 Apr 2018 07:48:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.201.62.139 with HTTP; Thu, 5 Apr 2018 07:47:45 -0700 (PDT) From: Jason Merrill Date: Thu, 5 Apr 2018 10:47:45 -0400 Message-ID: Subject: C++ PATCH for c++/85228, ICE with lambda in enumerator To: gcc-patches List X-IsSubscribed: yes Now that we instantiate lambdas with their enclosing context, the closure type doesn't have CLASSTYPE_TEMPLATE_INFO. Tested x86_64-pc-linux-gnu, applying to trunk. commit 7c51c3a6ef0b137fc124ba65f686a607370f2c3a Author: Jason Merrill Date: Thu Apr 5 10:26:20 2018 -0400 PR c++/85228 - ICE with lambda in enumerator. * pt.c (bt_instantiate_type_proc): Don't assume CLASSTYPE_TEMPLATE_INFO is non-null. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ed6e62c2364..dc74635876e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -22841,6 +22841,7 @@ bt_instantiate_type_proc (binding_entry entry, void *data) tree storage = *(tree *) data; if (MAYBE_CLASS_TYPE_P (entry->type) + && CLASSTYPE_TEMPLATE_INFO (entry->type) && !uses_template_parms (CLASSTYPE_TI_ARGS (entry->type))) do_type_instantiation (TYPE_MAIN_DECL (entry->type), storage, 0); } diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda21.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda21.C new file mode 100644 index 00000000000..8b0c95b37f3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda21.C @@ -0,0 +1,9 @@ +// PR c++/85228 +// { dg-additional-options -std=c++17 } + +template struct A +{ + enum E { e = []{ return 0; }() }; +}; + +template class A<0>;