blob: 9c625d18c95c28750d3506b7436c36326f7724e1 [file] [log] [blame]
Anders Carlssone41590d2009-06-24 00:10:43 +00001// RUN: clang-cc -fsyntax-only -verify %s
2
3void f1() {
4 struct X {
5 struct Y;
6 };
7
8 struct X::Y {
9 void f() {}
10 };
11}
12
13void f2() {
14 struct X {
15 struct Y;
16
17 struct Y {
18 void f() {}
19 };
20 };
21}
22
23// A class nested within a local class is a local class.
24void f3(int a) { // expected-note{{'a' declared here}}
25 struct X {
26 struct Y {
Mike Stump8e822102009-07-21 23:47:12 +000027 int f() { return a; } // expected-error{{reference to local variable 'a' declared in enclosed function 'f3'}}
Anders Carlssone41590d2009-06-24 00:10:43 +000028 };
29 };
Mike Stumpf0a6a0c2009-07-21 19:03:43 +000030}