summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/inline1.C
blob: 55b931138a115474249b6c843a109f4084dc45b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// PR c++/6316
// This testcase ICEd because when deferred bar()::F::F() was being
// expanded, containing bar() was still deferred and had DECL_EXTERNAL set
// (and DECL_NOT_REALLY_EXTERN too).
// { dg-do compile }
// { dg-options "-O3" }

struct A { ~A() throw() {} };
template<typename T, typename U> struct B { U a; B(const T *); };
typedef B<char, A> C;
struct D { D(); };
struct E { virtual ~E(); };

E *bar ();

void
foo ()
{
  E *a = bar ();
}

extern char *z [];

E *
bar ()
{
  struct F : public E
  {
    F ()
    {
      for (int i = 0; i < 2; i++)
	C e = z[i];
    }
    D x, y;
  };
  return new F ();
}

int
main ()
{
  foo ();
}