1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s 2*f4a2713aSLionel Sambuc f1()3*f4a2713aSLionel Sambucvoid f1() { 4*f4a2713aSLionel Sambuc struct X { 5*f4a2713aSLionel Sambuc struct Y; 6*f4a2713aSLionel Sambuc }; 7*f4a2713aSLionel Sambuc 8*f4a2713aSLionel Sambuc struct X::Y { 9*f4a2713aSLionel Sambuc void f() {} 10*f4a2713aSLionel Sambuc }; 11*f4a2713aSLionel Sambuc } 12*f4a2713aSLionel Sambuc f2()13*f4a2713aSLionel Sambucvoid f2() { 14*f4a2713aSLionel Sambuc struct X { 15*f4a2713aSLionel Sambuc struct Y; 16*f4a2713aSLionel Sambuc 17*f4a2713aSLionel Sambuc struct Y { 18*f4a2713aSLionel Sambuc void f() {} 19*f4a2713aSLionel Sambuc }; 20*f4a2713aSLionel Sambuc }; 21*f4a2713aSLionel Sambuc } 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc // A class nested within a local class is a local class. f3(int a)24*f4a2713aSLionel Sambucvoid f3(int a) { // expected-note{{'a' declared here}} 25*f4a2713aSLionel Sambuc struct X { 26*f4a2713aSLionel Sambuc struct Y { 27*f4a2713aSLionel Sambuc int f() { return a; } // expected-error{{reference to local variable 'a' declared in enclosing function 'f3'}} 28*f4a2713aSLionel Sambuc }; 29*f4a2713aSLionel Sambuc }; 30*f4a2713aSLionel Sambuc } 31