From patchwork Wed Jun 13 03:32:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 928636 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-479607-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="tbets0AN"; 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 415C5J0CSkz9s1B for ; Wed, 13 Jun 2018 13:33:21 +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=Ixd3su4jRWkvB/+B2AI5BRrVRLrmr1Md6tKQhtcQBY1dcw P1D7g/dF5I/LxQIyqdKMkGmO69pGPiW/ElwM7NlQP5WGgpNOpVwbuJzZPK9xPd6b Kv+Vw7N8S+NVTdG7sExyQC6zm350HWp5e34weHzC8ASQaSEQHsm377J5wrs6I= 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=0t7cr1jdVgMSLtfs/w29MeqYBn8=; b=tbets0ANqRzQblnPeqiz UPBWHAPowv5hwulRri5CZEvCjgVxNwOjZ/aa9RC/OSl1W5WaFdMZ4oJUiyxNlBqQ lkO9vtMyQWcSWuMHQeo/QpT8SMK8A+pNVtGjGoiN+rkDOlYpB6sPzrSGThx59mfK Af7mCsm9Py4x3BGDwCzeTa0= Received: (qmail 19408 invoked by alias); 13 Jun 2018 03:33:13 -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 19399 invoked by uid 89); 13 Jun 2018 03:33:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 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=Hx-languages-length:1807, parms X-HELO: mail-oi0-f53.google.com Received: from mail-oi0-f53.google.com (HELO mail-oi0-f53.google.com) (209.85.218.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Jun 2018 03:33:10 +0000 Received: by mail-oi0-f53.google.com with SMTP id d5-v6so1031590oib.5 for ; Tue, 12 Jun 2018 20:33:10 -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=vcumiWaiYgtJ4r5tQ+0CYnB9CTOmHsaeMqLrjVYKlGU=; b=YkLKWR3CYPjl4dmBMoMynYiiYdGkvMhRTxIu1arrNskPwoNKg7AdbbM5koiopb8x1/ M6Agb2lgqnThmTkdDJcpD76B+9/5EBa6bP6lFiJUgr0gJsmB8rZSJiBg17hmx+7To6xQ B56VEDvE5tLzjCIEXCsaBTDp/4V6JyE0xXqCUz3bmt/wTZ/AaFV0Mer9CxL4B5hKBs9o zGQDALHz5AWrrRvhur1In4KUyA31R7CJ0eisADDF8KJ/RvlSYFO0PrsysN5Ab3+5KDJG Y2IO2UXGYq8xm8Vg/is3cJ2hUMIDjA7pWrYrxeBctGy4/KphsJTG9+W669HUfZswv6Vz 6x2Q== X-Gm-Message-State: APt69E1ok71a8LaIh9F9YSi9mWEJ6GEjcju2fgJmqphu1jbGZcKLnCIE QBGWCvjkZBh1Mgly3j9WmH7zk6qrYUSslXaSwMlYhTuR X-Google-Smtp-Source: ADUXVKIfA3kkPfoc048xtBGAlxuzPBXe8jDGp4d7tpsHqcHWwWoW2WKM/q2U/ES0JThU+X6GBVNaYQiGFoXwklKLZO8= X-Received: by 2002:aca:3845:: with SMTP id f66-v6mr3290524oia.195.1528860788614; Tue, 12 Jun 2018 20:33:08 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac9:dd0:0:0:0:0:0 with HTTP; Tue, 12 Jun 2018 20:32:47 -0700 (PDT) From: Jason Merrill Date: Tue, 12 Jun 2018 23:32:47 -0400 Message-ID: Subject: C++ PATCH for c++/86098, ICE with template template parameter placeholder To: gcc-patches List X-IsSubscribed: yes When comparing two TEMPLATE_TYPE_PARM, we need to consider whether they are acting as placeholders for templates. Tested x86_64-pc-linux-gnu, applying to trunk. commit 10e5cb6bf4c605741ef59f17120304a3c261c06c Author: Jason Merrill Date: Tue Jun 12 22:38:07 2018 -0400 PR c++/86098 - ICE with template placeholder for TTP. * typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Check CLASS_PLACEHOLDER_TEMPLATE. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 9febdb908ae..b033afd9884 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1375,6 +1375,11 @@ structural_comptypes (tree t1, tree t2, int strict) template parameters set, they can't be equal. */ if (!comp_template_parms_position (t1, t2)) return false; + /* If T1 and T2 don't represent the same class template deduction, + they aren't equal. */ + if (CLASS_PLACEHOLDER_TEMPLATE (t1) + != CLASS_PLACEHOLDER_TEMPLATE (t2)) + return false; /* Constrained 'auto's are distinct from parms that don't have the same constraints. */ if (!equivalent_placeholder_constraints (t1, t2)) diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction58.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction58.C new file mode 100644 index 00000000000..82c3f83710f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction58.C @@ -0,0 +1,16 @@ +// PR c++/86098 +// { dg-additional-options -std=c++17 } + +template class future; +template T&& declval(); + +template