Debian Codegraph @

gcc/testsuite/g++.dg/ipa/pr92528.C

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -std=c++11 -w" } */
3
4 template <typename _T1, typename _T2> struct A {
5 _T1 first;
6 _T2 second;
7 template <typename _U1, typename _U2>
8 A(_U1 &&p1, _U2 p2) : first(p1), second(p2) {}
9 };
10 class B {
11 public:
12 B(char *);
13 };
14 struct C {
15 virtual ~C();
16 };
17 struct D {
18 virtual void registerReporter(B const &, int *) = 0;
19 };
20 template <typename, typename, typename, typename, typename = int> class F {
21 public:
22 void _M_get_insert_unique_pos();
23 template <typename... _Args> A<int, bool> _M_emplace_unique(_Args &&...);
24 };
25 template <typename _Key, typename _Val, typename _KeyOfValue, typename _Compare,
26 typename _Alloc>
27 template <typename... _Args>
28 A<int, bool> F<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_emplace_unique(
29 _Args &&...) try {
30 _M_get_insert_unique_pos();
31 } catch (...) {
32 }
33 class G {
34 F<int, int, int, int> _M_t;
35
36 public:
37 void insert(A<const B &, int *&> p1) { _M_t._M_emplace_unique(p1); }
38 };
39 class H {
40 public:
41 void registerReporter(B const &p1, int *p2) {
42 A<const B &, int *&> a(p1, p2);
43 m_factories.insert(a);
44 }
45 G m_factories;
46 };
47 namespace {
48 class J : C, D {
49 void registerReporter(B const &p1, int *p2) {
50 m_reporterRegistry.registerReporter(p1, p2);
51 }
52 H m_reporterRegistry;
53 };
54 J fn1();
55 } // namespace
56 void fn2() { fn1(); }
57 D &fn3();
58 class I {
59 public:
60 I(B p1) { fn3().registerReporter(p1, new int); }
61 };
62 namespace {
63 I b("");
64 }