summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/static-local-in-local-class.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-04-18 21:01:23 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-04-18 21:01:23 +0000
commit3fef72f0ba99f01b67fc75b8409bdb6d442bd1e6 (patch)
tree14fe33d2904703e25455ed0415181ff83c4e9698 /clang/test/CodeGenCXX/static-local-in-local-class.cpp
parent7b056bfed007a0e090eca4894988ec4eda4df5d0 (diff)
downloadbcm5719-llvm-3fef72f0ba99f01b67fc75b8409bdb6d442bd1e6.tar.gz
bcm5719-llvm-3fef72f0ba99f01b67fc75b8409bdb6d442bd1e6.zip
Local static variables must be available module-wise
as they are accessible in static methods in a class local to the same function. Fixes PR6769. llvm-svn: 101756
Diffstat (limited to 'clang/test/CodeGenCXX/static-local-in-local-class.cpp')
-rw-r--r--clang/test/CodeGenCXX/static-local-in-local-class.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/static-local-in-local-class.cpp b/clang/test/CodeGenCXX/static-local-in-local-class.cpp
new file mode 100644
index 00000000000..d9e044ce9d9
--- /dev/null
+++ b/clang/test/CodeGenCXX/static-local-in-local-class.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -emit-llvm -o %t %s
+// PR6769
+
+struct X {
+ static void f();
+};
+
+void X::f() {
+ static int *i;
+ {
+ struct Y {
+ static void g() {
+ i = new int();
+ *i = 100;
+ (*i) = (*i) +1;
+ }
+ };
+ (void)Y::g();
+ }
+ (void)i;
+}
OpenPOWER on IntegriCloud