From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 72CB93858D38 for ; Wed, 12 Oct 2022 18:23:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 72CB93858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665599025; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CJjUc77M7DNy8vHJHQn7H/49r2yibSdDnFsjLsqMSWE=; b=WNBS+8agW613UmC1kkQ6frGT82JqjbynAzhIG7xo9sBzFLJh0qTGwsyYDYFRzzz9j+Zc+1 q6LVWLwfdQGIkqFLAc06SS/E5NGo0lqBEe2H08OzHdo2Fk5weLfLPm1y8wE1XZP9BIZUyw vMk57vySlJJUxdXsO+4VX74bmsisfjU= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-183-1TE7FfxDNxua5myyBBXNBg-1; Wed, 12 Oct 2022 14:23:44 -0400 X-MC-Unique: 1TE7FfxDNxua5myyBBXNBg-1 Received: by mail-qv1-f72.google.com with SMTP id h3-20020a0ceec3000000b004b17a25f8bcso10369807qvs.23 for ; Wed, 12 Oct 2022 11:23:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CJjUc77M7DNy8vHJHQn7H/49r2yibSdDnFsjLsqMSWE=; b=lgifL1dRuI9TvU8V+rvekOsuU8aRSEjhLwLV+tKHLZREkpKoVXNBbRzV36XIeJ0n2H rZ04qaC/jSA2TEe7J11z4mGcopSc9zXgaQFwIe9WiTUFsbLwK9oqjIk8hEcyfH7mEvc5 F2i2g6s3c0M72se5zOlJ0xMwEpGrm2Bu4kdnAUO/1daksnmglg0aootZLzPKXjoi1czr kxTVbpIrz0XVFcLvdN6eS7BUBJIiSLDrUtvPA6p9smZ9nUc5R+F7jCNv1OvkQwzk6UE0 DQQoxyOyoof9l5YGTF+it+/A7ZfcCAIUT6zsjAqqNnNwnHnNl8W+3fVWA9N8NinRtCu/ 044Q== X-Gm-Message-State: ACrzQf2Y6PSbRmH339eLz1y7bF053vvWA6rMHO6wpMf96ZUaQ4+Lc8La QSM96pEcp/Mi8JaYBjEidyQdcrI1IH6KsM/YK6vkDo6qAfL3z5zGxMD/y+ZkztWbmgECe1SpNcL V2M9/o7lyYhw5pmzZuQ== X-Received: by 2002:ad4:5941:0:b0:4b4:46b5:e36b with SMTP id eo1-20020ad45941000000b004b446b5e36bmr8449440qvb.33.1665599023267; Wed, 12 Oct 2022 11:23:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6DJcByTAwwRGxUPLsM1s1589Cf6bIwDqw54QVYtNwB/kTUvK1ECZNfNHqEV5dCbDofsFqshw== X-Received: by 2002:ad4:5941:0:b0:4b4:46b5:e36b with SMTP id eo1-20020ad45941000000b004b446b5e36bmr8449428qvb.33.1665599023060; Wed, 12 Oct 2022 11:23:43 -0700 (PDT) Received: from redhat.com (2603-7000-9500-2e39-0000-0000-0000-1db4.res6.spectrum.com. [2603:7000:9500:2e39::1db4]) by smtp.gmail.com with ESMTPSA id t3-20020a05620a034300b006ecdfcf9d81sm8384441qkm.84.2022.10.12.11.23.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Oct 2022 11:23:42 -0700 (PDT) Date: Wed, 12 Oct 2022 14:23:40 -0400 From: Marek Polacek To: Jason Merrill Cc: GCC Patches Subject: Re: [PATCH v2] c++: ICE with VEC_INIT_EXPR and defarg [PR106925] Message-ID: References: <20221011200003.695682-1-polacek@redhat.com> <778ca670-6623-77f9-e941-51302007da64@redhat.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/2.2.7 (2022-08-07) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Oct 12, 2022 at 01:12:57PM -0400, Marek Polacek wrote: > On Wed, Oct 12, 2022 at 12:47:21PM -0400, Jason Merrill wrote: > > On 10/12/22 12:27, Marek Polacek wrote: > > > On Tue, Oct 11, 2022 at 04:28:11PM -0400, Jason Merrill wrote: > > > > On 10/11/22 16:00, Marek Polacek wrote: > > > > > Since r12-8066, in cxx_eval_vec_init we perform expand_vec_init_expr > > > > > while processing the default argument in this test. > > > > > > > > Hmm, why are we calling cxx_eval_vec_init during parsing of the default > > > > argument? In particular, any expansion that depends on the enclosing > > > > function context should be deferred until the default arg is used by a call. > > > > > > I think this is part of the semantic constraints checking [dcl.fct.default]/5 > > > talks about, as in, this doesn't compile even though the default argument is > > > not executed: > > > > > > struct S { > > > S() = delete; > > > }; > > > void foo (S = S()) { } > > > In the test below we parse '= MyVector<1>()' and end up calling mark_used > > > on the implicit "constexpr MyVector<1>::MyVector() noexcept ()" > > > ctor. mark_used calls maybe_instantiate_noexcept. Since the ctor has > > > a DEFERRED_NOEXCEPT, we have to figure out if the ctor should be noexcept > > > or not using get_defaulted_eh_spec. That means walking the members of > > > MyVector. Thus we reach > > > /* Core 1351: If the field has an NSDMI that could throw, the > > > default constructor is noexcept(false). */ > > > > Maybe we need a cp_unevaluated here? The operand of noexcept should be > > unevaluated. > > That wouldn't help since get_nsdmi specifically does "cp_evaluated ev;", > so... > > > > and call get_nsdmi on 'data'. There we digest its initializer which is {}. > > > massage_init_elt calls digest_init_r on the {} and produces > > > TARGET_EXPR > > D.2518 > > > {} >>>> > > > and the subsequent fold_non_dependent_init leads to cxx_eval_vec_init > > > -> expand_vec_init_expr. > > > > > > I think this is all correct except that the fold_non_dependent_init is > > > somewhat questionable to me; do we really have to fold in order to say > > > if the NSDMI init can throw? Sure, we need to digest the {}, maybe > > > the field's ctors can throw, but I don't know about the folding. > > > > And we can check cp_unevaluated_operand to avoid the > > fold_non_dependent_init? > > ...we'd still fold. I'm not sure if we want a LOOKUP_ flag that says > "we're just checking if we can throw, don't fold". Eh, a new flag is overkill. Maybe don't do cp_evaluated in get_nsdmi if we're called from walk_field_subobs would be worth a try? Marek