From patchwork Fri Feb 1 20:52:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 1035157 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-495105-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com 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 43rq7J1BR8z9s6w for ; Sat, 2 Feb 2019 07:52:55 +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:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=ldGp6nVn3wWWBp0jim9UgOx8H7Y6hNRoF410+QXCCsqDTM6pcb GWMxcIOgA/lQ57TIIdFuEa8mieZFKI68YJf2siH0zRKVRbmmaziEYM+fLMEqYWjD GDlocD06bggu+lKPdABkYnM6OBeG+eoOntllFJ9J3ViXaFSXTBPKjY4NI= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=xAO07khW+ZuLRg39PlFaA5LPn3A=; b=p4ctQ20Pco7kxC5ltyul ON5xp6yW53YCxs4FEEzQnluApDfH1453wYu3O/g/2roAR2cKJZa03fruhXEcZJJ5 VL7537vmPH0YFV3E1Fh3EAwpQ1lW8eRP3g1NSCMMmJBS6xqnBWMk9dON05F04tri 7VMbHznCD3zM/w14b/u+Ioo= Received: (qmail 125257 invoked by alias); 1 Feb 2019 20:52:48 -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 125244 invoked by uid 89); 1 Feb 2019 20:52:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: userp2130.oracle.com Received: from userp2130.oracle.com (HELO userp2130.oracle.com) (156.151.31.86) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 01 Feb 2019 20:52:46 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x11KnIpG116431; Fri, 1 Feb 2019 20:52:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : cc : from : subject : message-id : date : mime-version : content-type; s=corp-2018-07-02; bh=WzacwcV2cnxBZ4DvC8gUV8Zv8NzqyLHjDQ2US0tblAk=; b=i6jN5sf/Zlwdbvh8NaJgLRCEMa6XDMPFgRJtl9lwb6m+akMLIOvRso+PGEVnWLp+8K/A BKkXBb7eQ18KLopr5C+90H+lJr/mNij8LvRDnNrFEO3qI7U7VQ/OU70qcjkfkG4LXq1b o0YHPq3qs/CODoXpXDSr0q4FpNgWv6uUpHAu6SeIYBT1S76vHvzXNOw3lKCjCezmPKyk +1rX3RRnb7SvkyMd/PGWZwowklIqZRpDf6aQWk/h1/+j+Pxhia/KDe2JiqkFvehB66DB gnKWyuYVvJZ0JIwAOqV0lzrwzUIJx9hGTNkNTluRxYmvYhpuDVlydWHAI6U8F8slXwcI YA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2q8eyv0tmk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Feb 2019 20:52:44 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x11KqiDC022607 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 1 Feb 2019 20:52:44 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x11Kqhv9015191; Fri, 1 Feb 2019 20:52:43 GMT Received: from [192.168.1.4] (/79.19.31.237) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 01 Feb 2019 12:52:42 -0800 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 88986 ("[7/8/9 Regression] ICE: tree check: expected tree that contains 'decl minimal' structure, have 'error_mark' in member_vec_binary_search, at cp/name-lookup.c:1136") Message-ID: <56cdf537-a301-2b83-5b25-fe5b5af7667e@oracle.com> Date: Fri, 1 Feb 2019 21:52:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, I think that this ICE on invalid (and valid, for c++17+) can be in fact avoided by accepting in make_typename_type a TYPE_PACK_EXPANSION as context, thus by not triggering the "‘T ...’ is not a class" error. Not sure if a better fix would be something more general. Note, anyway, that we are asserting TYPE_P (context) thus TYPE_PACK_EXPANSIONs definitely get through beyond MAYBE_CLASS_TYPE_P. Tested x86_64-linux. Thanks, Paolo. /////////////////////////// /cp 2019-02-01 Paolo Carlini PR c++/88986 * decl.c (make_typename_type): Allow for TYPE_PACK_EXPANSION as context (the first argument). /testsuite 2019-02-01 Paolo Carlini PR c++/88986 * g++.dg/cpp1z/using4.C: New. Index: cp/decl.c =================================================================== --- cp/decl.c (revision 268447) +++ cp/decl.c (working copy) @@ -3816,7 +3816,9 @@ make_typename_type (tree context, tree name, enum gcc_assert (identifier_p (name)); gcc_assert (TYPE_P (context)); - if (!MAYBE_CLASS_TYPE_P (context)) + if (TREE_CODE (context) == TYPE_PACK_EXPANSION) + /* This can happen for C++17 variadic using (c++/88986). */; + else if (!MAYBE_CLASS_TYPE_P (context)) { if (complain & tf_error) error ("%q#T is not a class", context); Index: testsuite/g++.dg/cpp1z/using4.C =================================================================== --- testsuite/g++.dg/cpp1z/using4.C (nonexistent) +++ testsuite/g++.dg/cpp1z/using4.C (working copy) @@ -0,0 +1,8 @@ +// PR c++/88986 +// { dg-do compile { target c++11 } } +// { dg-options "" } + +template struct C : T... { + using typename T::type ...; // { dg-warning "pack expansion" "" { target c++14_down } } + void f() { type value; } +};