1 // { dg-do assemble }
2
3 // Copyright (C) 2000, 2002 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 7 Jan 2001 <nathan@codesourcery.com>
5
6 // As of G++ 3.4, we no longer attempt to detect dependencies; the
7 // standard does not require that we do.
8
9 // Bug 1038. Default args on class members can produce circular dependencies.
10 // Make sure we spot them, and don't depend on a particular ordering.
11
12 struct A
13 {
14 static int Foo (int = Baz ()); // { dg-error "" }
15 static int Baz (int = Foo ());
16 };
17
18 struct Test
19 {
20 Test (void * = 0);
21 void set (const Test &arg = Test ());
22 };
23
24 struct B
25 {
26 static int Bar (int = Foo (1));
27 static int Foo (int = Baz ()); // { dg-error "" }
28 static int Baz (int = Foo (1));
29 };
30
main()31 int main ()
32 {
33 Test t;
34 t.set ();
35 t.set (t);
36 B::Bar ();
37 B::Bar (1);
38 B::Baz ();
39 B::Baz (1);
40 B::Foo ();
41 B::Foo (1);
42
43 return 0;
44 }
45