From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50083 invoked by alias); 26 Feb 2018 17:50:54 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 49880 invoked by uid 89); 26 Feb 2018 17:50:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy= X-HELO: mail-io0-f194.google.com Received: from mail-io0-f194.google.com (HELO mail-io0-f194.google.com) (209.85.223.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 26 Feb 2018 17:50:53 +0000 Received: by mail-io0-f194.google.com with SMTP id 30so18136018iog.2 for ; Mon, 26 Feb 2018 09:50:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0TpESuwPEmQQM2q2e/OK4HhgggcISFkZ697tqyytofw=; b=H690KY53uQgLTyT/ZaRjB8XfCXNog6QPGgVuCvrRjIL3gymRDnD/1kmaAWHcHMIxeE F2yHHbvOSUPIHP9W46IUeqRMYJJkXeW5ubEhdXM1/saZ2nmw6V4sele8SyGvgNWTQp/V Y1wpTnagmr5ClDStf/DCNkGb6OF6lUZthKc0V4yXPrV4/EQ8nioaimmGh2ALLc/E5myi OTPpE4iK+zsV5AqwA+QCa9V+27EZ7WxtW+xQqLeIgExDa8eiPeAbr90mrvTedn0XkBuo nrLhhdnBNBofGngrTiczAoJrChisweVV9cq+05piGZh32ukhndnNJFkokAMju28VMZqX lLLg== X-Gm-Message-State: APf1xPD4SeJmDyKlBPSNhuDavEgsnSjqxh/zT1NVagGT/RBMM5sRDHwJ ch7mZEEmSWyoblk3A1KlE20ChESp8oA1lxwEqfpbmw== X-Google-Smtp-Source: AG47ELuhhAuaCFnStK5cjcvlCRza4x3OvnKDKwga3Alc9xj4XJ1hY1yHUKiq2/vKX8zJmmHH2RdaSiEwEtz+iGjVuD4= X-Received: by 10.107.37.212 with SMTP id l203mr12490967iol.20.1519667451481; Mon, 26 Feb 2018 09:50:51 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.17.200 with HTTP; Mon, 26 Feb 2018 09:50:30 -0800 (PST) In-Reply-To: <20180226174238.GK2995@redhat.com> References: <20180226174238.GK2995@redhat.com> From: Jason Merrill Date: Mon, 26 Feb 2018 17:50:00 -0000 Message-ID: Subject: Re: C++ PATCH to fix ICE with constexpr operator"" (PR c++/84325) To: Marek Polacek Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-02/txt/msg01447.txt.bz2 On Mon, Feb 26, 2018 at 12:42 PM, Marek Polacek wrote: > The original testcase was invalid but I added seconds's constructor and made > time_to_wait inline and now the testcase is accepted by clang++. > > But we ICE in replace_placeholders_r because we were checking TREE_CONSTANT > on a type. With this patch we accept the code without crashing. (We require > time_to_wait to be inline but clang++ does not.) > > Bootstrapped/regtested on x86_64-linux, ok for trunk? > > 2018-02-26 Marek Polacek > > PR c++/84325 > * tree.c (replace_placeholders_r): Only check TREE_CONSTANT on > non-types. > > * g++.dg/cpp1z/pr84325.C: New test. > > diff --git gcc/cp/tree.c gcc/cp/tree.c > index 39c1ef28b2d..298517ff83a 100644 > --- gcc/cp/tree.c > +++ gcc/cp/tree.c > @@ -3091,7 +3091,7 @@ replace_placeholders_r (tree* t, int* walk_subtrees, void* data_) > replace_placeholders_t *d = static_cast(data_); > tree obj = d->obj; > > - if (TREE_CONSTANT (*t)) > + if (!TYPE_P (*t) && TREE_CONSTANT (*t)) I'd make this if (TYPE_P (*t) || TREE_CONSTANT (*t)) so we don't keep walking into types. OK with that change. Jason