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 [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 0373A3853805 for ; Tue, 22 Jun 2021 20:12:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0373A3853805 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-527-8wAbNcf7N1iAwoYy9ZbtzA-1; Tue, 22 Jun 2021 16:12:44 -0400 X-MC-Unique: 8wAbNcf7N1iAwoYy9ZbtzA-1 Received: by mail-qk1-f199.google.com with SMTP id 81-20020a370e540000b02903aacdbd70b7so19400397qko.23 for ; Tue, 22 Jun 2021 13:12:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=xRmuSXNF2vWfaDcC5tiMX0C36cUFXC9LY7ixUxdIoD8=; b=EQxR3/XWX2Mu8elSck7128rk/O+tQynQhpEhAQNjfs7q6A+8cCsyQU5gR/bdKpr8qd BqYQ4ImaatObUSU1NFqcjSOgCpNSIlaUdKBZjxmkgzRJXpK+jgBOLxaApX0wnnd9LS7t 15P/xKfLEQX98xKLjpDWgCVgvyUpDcQnj52n6lrmW98e0UTpypZmFOX8hdfk+VAKnkgk jGn0fD1YFBRd5IdcEvQKPhRuC6cLNhhn2OZ2Au4KLZxi0TBzi0WHiRKuW3ynfQXZRo52 01x3l5b3rJsuims9Q2ONIKzgiiAWNZVMg2OHdPnJELa4vjf3ZXY/yMP4cQc4pvNDTmkA PYGg== X-Gm-Message-State: AOAM530mVPdpWTew6LZ5EPVUVG7ZFNJ/ZbQUAxjeqvr3LAiXWOUge5Zk MJr0fSMoqoiX+dFJGBe36LrK/lwgTJSaFIqMJ2elX1sVK3hgSBTASy+06ATPF+2owctCW5BKU0w f6rBS2OpVDBoG7FjfzuVQlF4134llxGTp1vK5fvVgvKvmDY1y4ONax6m9YVHR1Hk= X-Received: by 2002:ad4:4aea:: with SMTP id cp10mr546518qvb.43.1624392763835; Tue, 22 Jun 2021 13:12:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJww1Ys77FyA45nKVumMim9o+L2Yw94ggE2oZdGSHfPF1rHmSaUd/8uvErBJyV27GBU3sjtKGg== X-Received: by 2002:ad4:4aea:: with SMTP id cp10mr546483qvb.43.1624392763513; Tue, 22 Jun 2021 13:12:43 -0700 (PDT) Received: from [192.168.1.148] (130-44-159-43.s11817.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id s133sm13515772qke.97.2021.06.22.13.12.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Jun 2021 13:12:42 -0700 (PDT) Subject: Re: [PATCH] Add gnu::diagnose_as attribute To: Matthias Kretz , gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org References: <14205410.xuKvIAzr1H@excalibur> <2031764.yKVeVyVuyW@minbar> <8436091.EvYhyI6sBW@minbar> From: Jason Merrill Message-ID: Date: Tue, 22 Jun 2021 16:12:42 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <8436091.EvYhyI6sBW@minbar> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jun 2021 20:12:47 -0000 On 6/22/21 4:01 PM, Matthias Kretz wrote: > On Tuesday, 22 June 2021 21:52:16 CEST Jason Merrill wrote: >> For alias templates, you probably want the attribute only on the >> templated class, not on the instantiations. > > Oh good point. My current patch does not allow the attribute on alias > templates. Consider: > > template > struct X {}; > > template > using foo [[gnu::diagnose_as]] = X; > > I have no idea how this could work. I would have to set the attribute for an > implicit partial specialization (not that I know of the existence of such a > thing)? I.e. X would have to be diagnosed as foo, but X float> would have to be diagnosed as X, not foo. > > So if anything it should only support alias templates if they are strictly > "renaming" the type. I.e. their template parameters must match up exactly. Can > I constrain the attribute like this? Yes. You can check that with get_underlying_template. Or you could support the above by putting the attribute on the instantiation with the TEMPLATE_INFO for foo rather than a simple name. Jason