diff options
Diffstat (limited to 'test/CXX/class/class.local/p3.cpp')
| -rw-r--r-- | test/CXX/class/class.local/p3.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/CXX/class/class.local/p3.cpp b/test/CXX/class/class.local/p3.cpp new file mode 100644 index 000000000000..d888a6d93633 --- /dev/null +++ b/test/CXX/class/class.local/p3.cpp @@ -0,0 +1,30 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +void f1() { + struct X { + struct Y; + }; + + struct X::Y { + void f() {} + }; +} + +void f2() { + struct X { + struct Y; + + struct Y { + void f() {} + }; + }; +} + +// A class nested within a local class is a local class. +void f3(int a) { // expected-note{{'a' declared here}} + struct X { + struct Y { + int f() { return a; } // expected-error{{reference to local variable 'a' declared in enclosed function 'f3'}} + }; + }; +}
\ No newline at end of file |
