From d8ea81183a92c71cd50550137fe0aa2725c98b3f Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Mon, 18 Nov 2019 16:50:06 +0100 Subject: [PATCH] Add testcase for already fixed PR ipa/92528 2019-11-18 Martin Jambor PR ipa/92528 * g++.dg/ipa/pr92528.C: New test. From-SVN: r278415 --- gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/g++.dg/ipa/pr92528.C | 64 ++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ipa/pr92528.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 01e8e2b8a69..c7e4500c497 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-11-18 Martin Jambor + + PR ipa/92528 + * g++.dg/ipa/pr92528.C: New test. + 2019-11-18 Richard Sandiford * lib/target-supports.exp (check_effective_target_vect_check_ptrs): diff --git a/gcc/testsuite/g++.dg/ipa/pr92528.C b/gcc/testsuite/g++.dg/ipa/pr92528.C new file mode 100644 index 00000000000..7bc8d5aa65b --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr92528.C @@ -0,0 +1,64 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -std=c++11 -w" } */ + +template struct A { + _T1 first; + _T2 second; + template + A(_U1 &&p1, _U2 p2) : first(p1), second(p2) {} +}; +class B { +public: + B(char *); +}; +struct C { + virtual ~C(); +}; +struct D { + virtual void registerReporter(B const &, int *) = 0; +}; +template class F { +public: + void _M_get_insert_unique_pos(); + template A _M_emplace_unique(_Args &&...); +}; +template +template +A F<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_emplace_unique( + _Args &&...) try { + _M_get_insert_unique_pos(); +} catch (...) { +} +class G { + F _M_t; + +public: + void insert(A p1) { _M_t._M_emplace_unique(p1); } +}; +class H { +public: + void registerReporter(B const &p1, int *p2) { + A a(p1, p2); + m_factories.insert(a); + } + G m_factories; +}; +namespace { +class J : C, D { + void registerReporter(B const &p1, int *p2) { + m_reporterRegistry.registerReporter(p1, p2); + } + H m_reporterRegistry; +}; +J fn1(); +} // namespace +void fn2() { fn1(); } +D &fn3(); +class I { +public: + I(B p1) { fn3().registerReporter(p1, new int); } +}; +namespace { +I b(""); +} -- 2.30.2