This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] "decomposition declaration" -> "structured binding" in C++ diagnostics
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 3 Jul 2017 21:59:16 +0200
- Subject: Re: [C++ PATCH] "decomposition declaration" -> "structured binding" in C++ diagnostics
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jakub at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 16006315FC3
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 16006315FC3
- References: <20170630172630.GO2123@tucnak> <CADzB+2=Dea=Pe=APhXpRhyaG4r4-ZAerabC8QWXeMvHB9SKvgw@mail.gmail.com> <20170630193550.GQ2123@tucnak> <CADzB+2=jrQsLFG5dz7+CVCxrGsAKqgk-sYf_fhQOC5rj5VXqSQ@mail.gmail.com> <20170703160202.GY2123@tucnak> <CADzB+2nB8mOtj9xq+bL22N8KaDY2Bj55B1VRGyf0Pg0fsSifNA@mail.gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Jul 03, 2017 at 03:50:06PM -0400, Jason Merrill wrote:
> On Mon, Jul 3, 2017 at 12:02 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> > So like this?
>
> Looks good, except...
>
> > case sc_auto:
> > - error_at (loc, "decomposition declaration cannot be declared "
> > + error_at (loc, "structured binding declaration cannot be "
> > "C++98 %<auto%>");
> > break;
> > default:
>
> This case should just fall into the default gcc_unreachable, we aren't
> going to get C++98 auto in C++17 mode.
We actually support structured bindings (with a pedwarn that they are only
available in -std=c++1z) in older std modes (of course, it doesn't make
much sense in -std=c++98, because you always get either the above error
or error that the type of the structured binding is not appropriate; but
for -std=gnu++11 and above it works well).
If I remove the above error_at and fall through into gcc_unreachable,
we'll ICE.
Jakub