From ebea4e1da08608622e9db37c133c84120b8c5da8 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 29 Nov 2018 08:42:52 +0100 Subject: [PATCH] re PR c++/87539 (internal compiler error when compiling project with Os optimization flag) PR c++/87539 * g++.dg/cpp0x/pr87539.C: New test. From-SVN: r266611 --- gcc/testsuite/ChangeLog | 5 ++ gcc/testsuite/g++.dg/cpp0x/pr87539.C | 85 ++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr87539.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 07b8e8447d9..1764265073d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-11-29 Jakub Jelinek + + PR c++/87539 + * g++.dg/cpp0x/pr87539.C: New test. + 2018-11-28 Martin Sebor PR c/88065 diff --git a/gcc/testsuite/g++.dg/cpp0x/pr87539.C b/gcc/testsuite/g++.dg/cpp0x/pr87539.C new file mode 100644 index 00000000000..97c392f0c8f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr87539.C @@ -0,0 +1,85 @@ +// PR c++/87539 +// { dg-do compile { target c++11 } } +// { dg-options "-Os" } + +namespace a { +template class c; +class exception {}; +template struct e { d f; }; +struct g { g(); g(const g &); }; +} +template class h; +template struct i; +template struct aa { static const int k = j; }; +struct ac { typedef a::e l; }; +struct ad; +template struct ae { typedef m l; }; +template struct ae { typedef n l; }; +template struct o { + typedef typename ae::l l; +}; +struct af { af(char *); }; +template struct ag { ag(a::g = a::g()) {} }; +template +struct i, al> { typedef ag l; }; +namespace ak { +template struct ap { + typedef typename o::l ::l l; +}; +template struct aq { typedef ad l; }; +} +template struct as { + typedef char at; + template static decltype(au(), at()) av(int); + template static int av(...); + static const bool k = sizeof(av(0)) == 1; +}; +template struct aw { static const bool k = as::k; }; +template struct ax { typedef aw l; }; +template struct ay { typedef typename ax::l l; }; +template struct az : ay::l {}; +template struct ba : aa::k> {}; +template struct bb : ak::ap, ak::aq<>, int> {}; +template struct q : ba::l, int> {}; +template class r; +template struct r { + s operator*(); + s operator++(); +}; +template +class bc : public r>, int, q::k> {}; +template +int operator!=(bc, bc); +template struct h { + typedef af bl; + bc, int, ac>::l, int> begin(); + bc, int, ac>::l, int> end(); + template bm bn() const; + template int bo() const; + template int bx(const bl &, const bm &) const; + template int bp(const bl &) const; +}; +template +template +bm h::bn() const { typename i, bm>::l(); return bm(); } +template +template +int h::bo() const { i, int>::l(); bn(); return 0; } +template +template +int h::bx(const bl &bs, const bm &) const { bp(bs); return 0; } +template +template +int h::bp(const bl &) const { bo(); return 0; } +char bt[] = ""; +void +d() +{ + h bu; + for (auto bv : bu) + try { + bv.f.bx(bt, 0); + } catch (a::exception) { + } +} -- 2.30.2