1 // Tests for local types 2 marker1(void)3void marker1 (void) 4 { 5 } 6 marker2(void)7void marker2 (void) 8 { 9 } 10 foobar(int x)11int foobar (int x) 12 { 13 class Local { 14 public: 15 int loc1; 16 char loc_foo (char c) 17 { 18 return c + 3; 19 } 20 }; 21 22 Local l; 23 static Local l1; 24 char c; 25 26 marker1 (); 27 28 l.loc1 = 23; 29 30 c = l.loc_foo('x'); 31 return c + 2; 32 } 33 main()34int main() 35 { 36 int c; 37 38 c = foobar (31); 39 40 { // inner block 41 class InnerLocal { 42 public: 43 char ilc; 44 int * ip; 45 int il_foo (unsigned const char & uccr) 46 { 47 return uccr + 333; 48 } 49 class NestedInnerLocal { 50 public: 51 int nil; 52 int nil_foo (int i) 53 { 54 return i * 27; 55 } 56 }; 57 NestedInnerLocal nest1; 58 }; 59 60 InnerLocal il; 61 62 il.ilc = 'b'; 63 il.ip = &c; 64 marker2(); 65 } 66 } 67