From patchwork Wed May 27 13:53:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 1298938 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=qrscehEs; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49XC3P1ltqz9sT3 for ; Wed, 27 May 2020 23:53:37 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 524343973030; Wed, 27 May 2020 13:53:34 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by sourceware.org (Postfix) with ESMTPS id DBC26395A821 for ; Wed, 27 May 2020 13:53:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DBC26395A821 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nathanmsidwell@gmail.com Received: by mail-qk1-x731.google.com with SMTP id s1so24328019qkf.9 for ; Wed, 27 May 2020 06:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=sz19HJA92j8X+MH4iA+eP47WoZngG39WBAgzQlWE220=; b=qrscehEscMC7D6UVguFhYoKF7aRFRkfM25cuAYte618DYlYe8OUc2bzsqcO/szhLF8 J5NiLjZrN3A0THkg7Y/JEPaoqpetyXbuVkdTnrIMJ8Ahwq0rhOJEqWVK4I5TJPmaW7kU YKvdBtIuH5qAXN+fzMvrJH4W5pM+2eTinA2otPi53i/J4T6J5N4DJoKZu38Ja5dykGqQ jE4YSaGQHEMCwoICeRE6scAvnmrnIBeYx8eNrBNiQmXPgAx2OrTdBZ1EmgH+6xUjZPHJ 75gM08Zv0nEwjAADdXOm7FaM8Wd3foTB72B9icGcplUb7JkOG72WpG1EULt1Xcr2XpJJ uQyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version:content-language; bh=sz19HJA92j8X+MH4iA+eP47WoZngG39WBAgzQlWE220=; b=UKExvwUQFS+rk9VZ7qTvExsqe7NIzWnUKLQJRFJoHW9lhVpQ6b0E4UD08hf872qjjm tDf7EyxvLG1DcCF9eG465SmHizRA56ZHRuw6SxocwkQtIxAyjml3oVCRMHsQvZrRXDcZ GkHRVCp0oeEx6wFerBQCNB8QN0jwWSInoGS0f4pa6EAmDYRUgi4OEE+A8XlVR2jMfjvP +aJXPwRr9u5B9I4dL8Jsj47gAHCJcnmYWB8V2nMZoJsjob+I1VAaQYhN/armS2oAozKg da1ze/L6NEJKJItLXuyiPVym59WdROUNZZjR278XD8MqaTTaf5qA4A2jhpbJ+LNYBiY8 O1lA== X-Gm-Message-State: AOAM532HoHC+7EKhfaZm+xOyTlKVA9v22jGzYh9L+v1stPKAH3Tg38bf 3WarC5m8+Brjpw4PN7P9gFk= X-Google-Smtp-Source: ABdhPJzLT0sLJzARQxM8HpaQUVVsREitbRIZXOLYVaw1nVffD/YHM/FQOGLVfZUG8Yd/U5jNvmclwg== X-Received: by 2002:a37:c20c:: with SMTP id i12mr4385681qkm.167.1590587611343; Wed, 27 May 2020 06:53:31 -0700 (PDT) Received: from ?IPv6:2620:10d:c0a8:1102:94c4:b7f0:9766:f4f8? ([2620:10d:c091:480::1:8168]) by smtp.googlemail.com with ESMTPSA id m33sm2435637qte.17.2020.05.27.06.53.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 May 2020 06:53:29 -0700 (PDT) To: GCC Patches From: Nathan Sidwell Subject: [PR c++/95263] Revert alias template change Message-ID: <89f54648-ab7c-7bf9-145d-eaae9fe3455c@acm.org> Date: Wed, 27 May 2020 09:53:28 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Sadly my attempt to make some aliast template construction immutable doesn't always apply. Reverting that patch and I guess more work needed on modules :( nathan 2020-05-27 Nathan Sidwell PR c++/95263, revert 74744bb1f2847b5b9ce3e97e0fec9c23bb0e499f * pt.c (lookup_template_class_1): Restore alias template mutation. diff --git i/gcc/cp/pt.c w/gcc/cp/pt.c index c17a038c6d0..4d9651acee6 100644 --- i/gcc/cp/pt.c +++ w/gcc/cp/pt.c @@ -10062,21 +10062,8 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context, } } - /* Build template info for the new specialization. This can - overwrite the existing TEMPLATE_INFO for T (that points to - its instantiated TEMPLATE_DECL), with this one that points to - the most general template, but that's what we want. */ - - if (TYPE_ALIAS_P (t)) - { - /* This should already have been constructed during - instantiation of the alias decl. */ - tree ti = DECL_TEMPLATE_INFO (TYPE_NAME (t)); - gcc_checking_assert (template_args_equal (TI_ARGS (ti), arglist) - && TI_TEMPLATE (ti) == found); - } - else - SET_TYPE_TEMPLATE_INFO (t, build_template_info (found, arglist)); + // Build template info for the new specialization. + SET_TYPE_TEMPLATE_INFO (t, build_template_info (found, arglist)); elt.spec = t; slot = type_specializations->find_slot_with_hash (&elt, hash, INSERT); diff --git c/gcc/testsuite/g++.dg/template/pr95263.C w/gcc/testsuite/g++.dg/template/pr95263.C new file mode 100644 index 00000000000..08a1b8730c0 --- /dev/null +++ w/gcc/testsuite/g++.dg/template/pr95263.C @@ -0,0 +1,23 @@ +// { dg-do compile { target c++11 } } +// PR C++/95263 +// ICE on alias template instantiation + +template class TPL { + template using INT = int; +}; + +template class Klass +{ +public: + template using ALIAS = typename TPL::INT; + + template static void FUNC (); // OK + + template static ALIAS FUNC (); // SFINAE ICE +}; + +void Fn () +{ + Klass::FUNC<0> (); +} +