Be careful about comdat boundary in ICF (PR ipa/82352).
[official-gcc.git] / gcc / testsuite / g++.dg / ipa / pr82352.C
blobc044345a486c38c614fce7497a3eb52d7c497e7b
1 // PR ipa/82352
2 // { dg-do compile }
3 // { dg-options "-O2" }
5 typedef long unsigned int size_t;
7 class A
9 public :
10   typedef enum { Zero = 0, One = 1 } tA;
11   A(tA a) { m_a = a; }
13 private :
14   tA m_a;
17 class B
19 public :
20   void *operator new(size_t t) { return (void*)(42); };
23 class C
25 public:
26   virtual void ffff () = 0;
29 class D
31  public :
32   virtual void g() = 0;
33   virtual void h() = 0;
36 template<class T> class IIII: public T, public D
38 public:
39  void ffff()
40  {
41    if (!m_i2) throw A(A::One);
42  };
44  void h()
45  {
46   if (m_i2) throw A(A::Zero);
47  }
49 protected:
50  virtual void g()
51  {
52   if (m_i1 !=0) throw A(A::Zero);
53  };
55 private :
56  int m_i1;
57  void *m_i2;
60 class E
62 private:
63     size_t m_e;
64     static const size_t Max;
66 public:
67     E& i(size_t a, size_t b, size_t c)
68     {
69         if ((a > Max) || (c > Max)) throw A(A::Zero );
70         if (a + b > m_e) throw A(A::One );
71         return (*this);
72     }
74   inline E& j(const E &s)
75     {
76       return i(0,0,s.m_e);
77     }
80 class F : public C { };
81 class G : public C { };
82 class HHHH : public B, public F, public G { };
84 void k()
86     new IIII<HHHH>();
89 void l()
91   E e1, e2;
92   e1.j(e2);