public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Marek Polacek <polacek@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] c++: DR2397 - auto specifier for * and & to arrays [PR100975]
Date: Wed, 30 Jun 2021 09:30:51 -0400	[thread overview]
Message-ID: <80488c0e-0465-cb07-9596-15f796efde70@redhat.com> (raw)
In-Reply-To: <YNuYRuIFnuWbJwTl@redhat.com>

On 6/29/21 6:01 PM, Marek Polacek wrote:
> On Tue, Jun 29, 2021 at 03:50:27PM -0400, Jason Merrill wrote:
>> On 6/29/21 3:25 PM, Marek Polacek wrote:
>>> --- a/gcc/testsuite/g++.dg/cpp0x/auto3.C
>>> +++ b/gcc/testsuite/g++.dg/cpp0x/auto3.C
>>> @@ -10,7 +10,7 @@ auto x;				// { dg-error "auto" }
>>>    auto i = 42, j = 42.0;		// { dg-error "auto" }
>>>    // New CWG issue
>>
>> Let's at least update this comment to quote [dcl.type.auto.deduct]/2: "T
>> shall not be an array type".  I guess "unable to deduce" is a suitable
>> diagnostic for that error.
> 
> Fixed.
> 
>>> diff --git a/gcc/testsuite/g++.dg/diagnostic/auto1.C b/gcc/testsuite/g++.dg/diagnostic/auto1.C
>>> index ee2eefd59aa..9d9979e3fdc 100644
>>> --- a/gcc/testsuite/g++.dg/diagnostic/auto1.C
>>> +++ b/gcc/testsuite/g++.dg/diagnostic/auto1.C
>>> @@ -1,4 +1,5 @@
>>>    // PR c++/86915
>>>    // { dg-do compile { target c++17 } }
>>> +// Allowed since DR2397.
>>
>> Well, not really; any attempt to use this template should hit the same
>> problem as above of trying to do auto deduction where T is an array type.
>> Please add to the testcase to get the error.
> 
> Hmm, this
> 
> template<auto [1]> struct S { };
> static int arr[1];
> S<arr> s;
> 
> won't give an error: I think it's because we coerce the auto tparm into 'auto*'
> before deducing and so don't get the type mismatch error.  That seems to be
> in line with how 'template<int [1]>' works, though.

Ah, good point.

> So I think we don't need to change this in the patch.  Do you agree?

Yes, the patch is OK with the earlier comment tweak.

Jason


      reply	other threads:[~2021-06-30 13:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29 19:25 Marek Polacek
2021-06-29 19:50 ` Jason Merrill
2021-06-29 22:01   ` Marek Polacek
2021-06-30 13:30     ` Jason Merrill [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80488c0e-0465-cb07-9596-15f796efde70@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=polacek@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).