From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by sourceware.org (Postfix) with ESMTPS id 7E9C73844B26 for ; Thu, 8 Dec 2022 12:41:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7E9C73844B26 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=acm.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qv1-xf2f.google.com with SMTP id r15so851120qvm.6 for ; Thu, 08 Dec 2022 04:41:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=931ntARLY7NJVWlTFQHOZQSyVyV5Ya4mEvroT8PgK2w=; b=Z3tksSbvMCv3yd0GlSH0xSburcnAXndqbxSYmOVhi1uvqUzfOyJ0Dm3s8TnkhRXBEp ehf4xwReuFg/nD603qA24AgGDr1xwpFCIqPK1FdDTYWJgZq1TBs/u5UDCGrNXB+e3mLM LxaNQNuzWrBopftU+0veIr5w6U1DF6+INu/cOaQMei56EL/sEEN0qMl2Lkryb3cmQ3kH nA8AW6flL5smVfTFLCn3guVobcRCmLvxp7AUeqlIPRj1FQFPWodFQr+eOA31hT3MGGMn 20k9F7lu5JBEe8OhTtGFvEoHI/0/NTfmfIy3SqKFY43+8UbTICo5JtavCjPFILPDi1AQ jIaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=931ntARLY7NJVWlTFQHOZQSyVyV5Ya4mEvroT8PgK2w=; b=ST/ZhBv9mggf1d6A+Bl+KSVvDnRub6R7oT710S9fsco3iXM2Y1OqhF/7uuAosoHttP eZT9b4b2DhrCfY1+uV8aWrrR0Iopd0ERBcY8qZmuis+tP6+tdul/Eo5GVAHOtqyKfmhV +mitsd2dGEe2A3FQDspwYMxcqXO5VWRtw4nCY/ZJKtC9n/d/V5RWNVb+/yeXRsg4hp09 1zoCyzTboBULJGk1KdXEtECPFgp1dqrvVH7LwvVlHkWGPZtPC4Vq8R697UwnpVhhU+fl OG9yTSAej0sbg6Cbl51zqh+ThRiHpjzYDAlDFi4WNPuAMczSFXuu0luBlz2nDwNlhc26 9+KQ== X-Gm-Message-State: ANoB5pmVP6E1cQapVFuykKlUGYJ5RwMXczECzInysBIVGoNbYptRTXtp cYNkXVBl2FVUYl3gPgXgVmk= X-Google-Smtp-Source: AA0mqf42t9li5Ooz9gm6HYkqnSOiBak1F/uEYClKjn4pdtSuRLKbl+XJ77EH7pehA7JAFYp+soixyw== X-Received: by 2002:a0c:f7c2:0:b0:4c7:1cf8:c2af with SMTP id f2-20020a0cf7c2000000b004c71cf8c2afmr3085348qvo.46.1670503279668; Thu, 08 Dec 2022 04:41:19 -0800 (PST) Received: from ?IPV6:2601:19c:527f:bfd0:cb20:e74:ead7:4cfe? ([2601:19c:527f:bfd0:cb20:e74:ead7:4cfe]) by smtp.googlemail.com with ESMTPSA id bl21-20020a05620a1a9500b006ce9e880c6fsm19312153qkb.111.2022.12.08.04.41.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Dec 2022 04:41:19 -0800 (PST) Sender: Nathan Sidwell Message-ID: <6658e6b7-28af-aafa-a45e-970805474667@acm.org> Date: Thu, 8 Dec 2022 07:41:15 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH] c++: modules and std::source_location::current() def arg [PR100881] Content-Language: en-US To: Patrick Palka , gcc-patches@gcc.gnu.org Cc: jason@redhat.com References: <20221207215028.1851790-1-ppalka@redhat.com> From: Nathan Sidwell In-Reply-To: <20221207215028.1851790-1-ppalka@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3031.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no 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 12/7/22 16:50, Patrick Palka wrote: > We currently declare __builtin_source_location with a const void* return > type instead of the true type (const std::source_location::__impl*), and > later when folding this builtin we just obtain the true type via name > lookup. > > But the below testcase demonstrates this name lookup approach seems to > interact poorly with modules, since we may import an entity that uses > std::source_location::current() in a default argument (or DMI) without > also importing , and thus the name lookup will fail > when folding the builtin at the call site unless we also import > . > > This patch fixes by instead initially declaring __builtin_source_location > with an auto return type and updating it appropriately upon its first use. > Thus when folding calls to this builtin we can fish out the true return > type through the type of the CALL_EXPR and avoid needing to do name > lookup. That's a clever approach! LGTM nathan -- Nathan Sidwell