Bug 79253 - [7 Regression] ICE in tsubst_copy starting with r243723
Summary: [7 Regression] ICE in tsubst_copy starting with r243723
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 7.0
: P1 normal
Target Milestone: 7.0
Assignee: Nathan Sidwell
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-26 22:10 UTC by Jakub Jelinek
Modified: 2017-01-31 18:08 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-01-26 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2017-01-26 22:10:44 UTC
Since r243723 we ICE on the following testcase:
template <typename> struct A;
template <typename = A<int>> class B {};
template <class T, class U, class V> void foo (U, V) { T (0, 0); }
struct C {};
template <template <bool, bool, bool> class F, class>
void
bar ()
{
  F<0, 0, 0>::baz;
}
struct G { int l; };
template <int, int, int> struct E : C
{
  E (int, int) : e (0)
  {
    auto &m = this->m ();
    auto c = [&] { m.l; };
  }
  G &m ();
  int e;
};
struct D
{
  void
  baz () { bar<F, B<>>; }
  template <bool, bool, bool> struct F
  {
    static B<> baz () { foo<E<0, 0, 0>> (0, 0); }
  };
};

reduced from mathicgb:
src/mathicgb/ModuleMonoSet.cpp:184:1:   required from here
src/mathicgb/ModuleMonoSet.cpp:71:34: internal compiler error: in tsubst_copy, at cp/pt.c:14400
       const auto& monoid = this->monoid(); // workaround for gcc 4.5.3 issue
                            ~~~~~~^~~~~~
Comment 1 Nathan Sidwell 2017-01-31 18:06:09 UTC
Author: nathan
Date: Tue Jan 31 18:05:37 2017
New Revision: 245067

URL: https://gcc.gnu.org/viewcvs?rev=245067&root=gcc&view=rev
Log:
	PR c++/67273
	PR c++/79253
	* pt.c: (instantiate_decl): Push to top level when current
	function scope doesn't match.  Only push lmabda scope stack when
	pushing to top.

	PR c++/67273
	PR c++/79253
	* g++.dg/cpp1y/pr67273.C: New.
	* g++.dg/cpp1y/pr79253.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/pr67273.C
    trunk/gcc/testsuite/g++.dg/cpp1y/pr79253.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog
Comment 2 Nathan Sidwell 2017-01-31 18:08:13 UTC
Fixed r245067.