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 AFDD6385734F for ; Wed, 12 Oct 2022 17:13:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AFDD6385734F 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=1665594782; 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=cv5zFzueQ8R8bCO92OEX+ekj3w3HUTJEadT3bQ2XdiM=; b=FkcD2EWEGumh0xy9O0gwIgq2GhQl/wjHWAu037B82y+6Y1nPD3BRUDifGe5onmcl6Okqd+ n0dQCv3Fx81OIJlk2CDBUu2kYUxaFgdDJkLNmBISD9g37FZJZ9wJ20rkDZVHTki/MYCyy9 L6rwwgwe0DRNBLemdA56oyNR6qzAD9s= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-675-hyRws6zXMW6ufCxxEWOc3Q-1; Wed, 12 Oct 2022 13:13:01 -0400 X-MC-Unique: hyRws6zXMW6ufCxxEWOc3Q-1 Received: by mail-qk1-f199.google.com with SMTP id x22-20020a05620a259600b006b552a69231so14742911qko.18 for ; Wed, 12 Oct 2022 10:13:01 -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=cv5zFzueQ8R8bCO92OEX+ekj3w3HUTJEadT3bQ2XdiM=; b=C5zrqaJQyUIpy5b+gqHAB/0k1q11TAG6F1gHPOgLLgo6kgknkQFFmn/47RZ3/7c3Pr Nf3V+3N4voZxdeEaB3Du7F9rYE8r6CBWgYgHO2SzP5t8KcVResn9mjYoJJKfzKb6osP2 Dtm6/S1YMPP7c6sPjwXUUJzwtXFNVbKvWiPYRWe7FoauDHf5o77sVsnL8+SX2U8qKAQO dAXMclzwc5mSxPut/eU09U0Y0TEwZmx4HxftkDPQi6fHXzsh41yxhniqBOAW2inprjrB qH6rxnL/Mbg8C0mDHDekDP6yIo8HRPFNNFVlTR5xC2m7kVN35diWzvTLgjuROP1yJwYs VL3w== X-Gm-Message-State: ACrzQf00LxAeKckieot/7NKGrPaqUTVmNYVQ6DIZko0Ip/JXMm+FxlZX jYh3yk83GvdVhvSCFAl/K7mApupGKo4ycpa5jSKDlRrHhw68v/f/OpSqR5ZxXjMCV7Ned5ouHs1 FKWEQEQDpV96YjnRHsg== X-Received: by 2002:a05:620a:2723:b0:6df:b61f:99f6 with SMTP id b35-20020a05620a272300b006dfb61f99f6mr20978649qkp.3.1665594780235; Wed, 12 Oct 2022 10:13:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78MzIL7NdJVCkMhpIBR+Qf47O7gBcfi7Up8ypP1xYUePWWqMSLw8jzxbzx8+O3d28cG75Z3A== X-Received: by 2002:a05:620a:2723:b0:6df:b61f:99f6 with SMTP id b35-20020a05620a272300b006dfb61f99f6mr20978620qkp.3.1665594779852; Wed, 12 Oct 2022 10:12:59 -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 ca6-20020a05622a1f0600b003994bbe91bdsm8305750qtb.60.2022.10.12.10.12.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Oct 2022 10:12:59 -0700 (PDT) Date: Wed, 12 Oct 2022 13:12:57 -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.4 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 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". Marek