Bug 87122 - [8/9 Regression] ICE in tsubst_decomp_names
Summary: [8/9 Regression] ICE in tsubst_decomp_names
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 9.0
: P2 normal
Target Milestone: 8.3
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2018-08-28 08:35 UTC by Jakub Jelinek
Modified: 2018-08-31 17:18 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-08-28 00:00:00


Attachments
gcc9-pr87122.patch (796 bytes, patch)
2018-08-28 10:43 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2018-08-28 08:35:18 UTC
Starting with r256795 gcc ICEs on:

struct S { int a, b; };

template <bool>
void
foo ()
{
  S x[2];
  auto f = [](auto & y) { for (auto & [ u, v ] : y) ; };
  f (x);
}

int
main ()
{
  foo<true> ();
}

with -std=c++17, previously it has been incorrectly rejected.
Comment 1 Jakub Jelinek 2018-08-28 10:43:52 UTC
Created attachment 44614 [details]
gcc9-pr87122.patch

Untested fix.
Comment 2 Jakub Jelinek 2018-08-29 12:28:27 UTC
Author: jakub
Date: Wed Aug 29 12:27:55 2018
New Revision: 263953

URL: https://gcc.gnu.org/viewcvs?rev=263953&root=gcc&view=rev
Log:
	PR c++/87122
	* pt.c (tsubst_expr) <case RANGE_FOR_STMT>: If
	processing_template_decl and decl is structured binding decl, call
	cp_finish_decomp.

	* g++.dg/cpp1z/decomp47.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1z/decomp47.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Jakub Jelinek 2018-08-29 12:32:45 UTC
Author: jakub
Date: Wed Aug 29 12:32:13 2018
New Revision: 263954

URL: https://gcc.gnu.org/viewcvs?rev=263954&root=gcc&view=rev
Log:
	PR c++/87122
	* pt.c (tsubst_expr) <case RANGE_FOR_STMT>: If
	processing_template_decl and decl is structured binding decl, call
	cp_finish_decomp.

	* g++.dg/cpp1z/decomp47.C: New test.

Added:
    branches/gcc-8-branch/gcc/testsuite/g++.dg/cpp1z/decomp47.C
Modified:
    branches/gcc-8-branch/gcc/cp/ChangeLog
    branches/gcc-8-branch/gcc/cp/pt.c
    branches/gcc-8-branch/gcc/testsuite/ChangeLog
Comment 4 Jakub Jelinek 2018-08-31 17:18:13 UTC
Fixed.