1 // PR c++/6316
2 // This testcase ICEd because when deferred bar()::F::F() was being
3 // expanded, containing bar() was still deferred and had DECL_EXTERNAL set
4 // (and DECL_NOT_REALLY_EXTERN too).
5 // { dg-do compile }
6 // { dg-options "-O3" }
7 
throwA8 struct A { ~A() throw() {} };
9 template<typename T, typename U> struct B { U a; B(const T *); };
10 typedef B<char, A> C;
11 struct D { D(); };
12 struct E { virtual ~E(); };
13 
14 E *bar ();
15 
16 void
foo()17 foo ()
18 {
19   E *a = bar ();
20 }
21 
22 extern char *z [];
23 
24 E *
bar()25 bar ()
26 {
27   struct F : public E
28   {
29     F ()
30     {
31       for (int i = 0; i < 2; i++)
32 	C e = z[i];
33     }
34     D x, y;
35   };
36   return new F ();
37 }
38 
39 int
main()40 main ()
41 {
42   foo ();
43 }
44