Hi! The PR86687 fix fixed ICE on the following testcase on mingw. Because the PR was about fixing debug info, I think it is worth adding this testcase to the testsuite. The testcase is as far as creduce managed to reduce it after almost 18 hours. Tested on x86_64-linux and with a cross to x86_64-w64-mingw32, ok for trunk?
./cc1plus.263163 -quiet -Os pr87539.ii pr87539.ii:65:59: internal compiler error: in tsubst_default_argument, at cp/pt.c:12712 bm h<bq, br, am>::bn() const { typename i<a::c<int>, bm>::l(); return bm(); } ^~~ 0xa512db tsubst_default_argument(tree_node*, int, tree_node*, tree_node*, int) ../../gcc/cp/pt.c:12712 0x8429ec convert_default_arg(tree_node*, tree_node*, tree_node*, int, int) ../../gcc/cp/call.c:7372 ... 2018-11-28 Jakub Jelinek <ja...@redhat.com> PR c++/87539 * g++.dg/cpp0x/pr87539.C: New test. --- gcc/testsuite/g++.dg/cpp0x/pr87539.C.jj 2018-11-28 09:04:33.606191870 +0100 +++ gcc/testsuite/g++.dg/cpp0x/pr87539.C 2018-11-28 09:04:04.479668392 +0100 @@ -0,0 +1,85 @@ +// PR c++/87539 +// { dg-do compile { target c++11 } } +// { dg-options "-Os" } + +namespace a { +template <typename b, typename = b, typename = int> class c; +class exception {}; +template <typename d> struct e { d f; }; +struct g { g(); g(const g &); }; +} +template <class, class, class = int> class h; +template <typename, typename> struct i; +template <int j> struct aa { static const int k = j; }; +struct ac { typedef a::e<int> l; }; +struct ad; +template <int, typename m, typename> struct ae { typedef m l; }; +template <typename m, typename n> struct ae<false, m, n> { typedef n l; }; +template <typename m, typename n, typename p> struct o { + typedef typename ae<m::k, n, p>::l l; +}; +struct af { af(char *); }; +template <typename> struct ag { ag(a::g = a::g()) {} }; +template <typename ah, typename ai, typename aj, typename al> +struct i<a::c<ah, ai, aj>, al> { typedef ag<al> l; }; +namespace ak { +template <typename am, typename an, typename ao> struct ap { + typedef typename o<am, an, ao>::l ::l l; +}; +template <typename = ad> struct aq { typedef ad l; }; +} +template <typename ar> struct as { + typedef char at; + template <typename au, typename> static decltype(au(), at()) av(int); + template <typename, typename> static int av(...); + static const bool k = sizeof(av<ar, int>(0)) == 1; +}; +template <typename ar> struct aw { static const bool k = as<ar>::k; }; +template <class ar> struct ax { typedef aw<ar> l; }; +template <typename ar> struct ay { typedef typename ax<ar>::l l; }; +template <typename ar> struct az : ay<ar>::l {}; +template <class ar, class> struct ba : aa<az<ar>::k> {}; +template <class> struct bb : ak::ap<ba<int, int>, ak::aq<>, int> {}; +template <typename> struct q : ba<bb<int>::l, int> {}; +template <class, class, bool> class r; +template <class s, class t> struct r<s, t, false> { + s operator*(); + s operator++(); +}; +template <class, class, class, class, class> +class bc : public r<a::e<h<int, int>>, int, q<int>::k> {}; +template <class bd, class be, class bf, class u, class v, class bg, class w, + class x, class bh, class bi> +int operator!=(bc<bd, be, bf, u, v>, bc<bg, w, x, bh, bi>); +template <class, class, class> struct h { + typedef af bl; + bc<int, int, int, ak::ap<aa<false>, int, ac>::l, int> begin(); + bc<int, int, int, ak::ap<aa<false>, int, ac>::l, int> end(); + template <class bm> bm bn() const; + template <class> int bo() const; + template <class bm> int bx(const bl &, const bm &) const; + template <class> int bp(const bl &) const; +}; +template <class bq, class br, class am> +template <class bm> +bm h<bq, br, am>::bn() const { typename i<a::c<int>, bm>::l(); return bm(); } +template <class bq, class br, class am> +template <class> +int h<bq, br, am>::bo() const { i<a::c<int>, int>::l(); bn<int>(); return 0; } +template <class bq, class br, class am> +template <class bm> +int h<bq, br, am>::bx(const bl &bs, const bm &) const { bp<int>(bs); return 0; } +template <class bq, class br, class am> +template <class> +int h<bq, br, am>::bp(const bl &) const { bo<int>(); return 0; } +char bt[] = ""; +void +d() +{ + h<int, int> bu; + for (auto bv : bu) + try { + bv.f.bx(bt, 0); + } catch (a::exception) { + } +} Jakub