FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.other / defarg7.C
blobe4a27a39bc9d00c778d7e760496c61fa6be9a452
1 // Build don't link:
3 // Copyright (C) 2000, 2002 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 7 Jan 2001 <nathan@codesourcery.com>
6 // As of G++ 3.4, we no longer attempt to detect dependencies; the
7 // standard does not require that we do.
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.
12 struct A
14   static int Foo (int = Baz ()); // ERROR - 
15   static int Baz (int = Foo ());
18 struct Test
20   Test (void * = 0);
21   void set (const Test &arg = Test ());
24 struct B
26   static int Bar (int = Foo (1));
27   static int Foo (int = Baz ()); // ERROR - 
28   static int Baz (int = Foo (1));
31 int main ()
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;