summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/static-mutable.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-02-17 06:48:11 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-02-17 06:48:11 +0000
commite070fd2ac88f067f3c78a9adc9f2a7d58c0b127b (patch)
tree4ec97af700256a079aa1b662e5f509019c9cc0d7 /clang/test/CodeGenCXX/static-mutable.cpp
parentae819500a16af284fe03e2951be714f6b89ad56f (diff)
downloadbcm5719-llvm-e070fd2ac88f067f3c78a9adc9f2a7d58c0b127b.tar.gz
bcm5719-llvm-e070fd2ac88f067f3c78a9adc9f2a7d58c0b127b.zip
Bug fix: do not emit static const local variables with mutable members
as constants. Refactor and simplify all the separate checks for whether a type can be emitted as a constant. llvm-svn: 150793
Diffstat (limited to 'clang/test/CodeGenCXX/static-mutable.cpp')
-rw-r--r--clang/test/CodeGenCXX/static-mutable.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/static-mutable.cpp b/clang/test/CodeGenCXX/static-mutable.cpp
new file mode 100644
index 00000000000..6d51f241d16
--- /dev/null
+++ b/clang/test/CodeGenCXX/static-mutable.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 %s -triple=i686-linux-gnu -emit-llvm -o - | FileCheck %s
+
+struct S {
+ mutable int n;
+};
+int f() {
+ // The purpose of this test is to ensure that this variable is a global
+ // not a constant.
+ // CHECK: @_ZZ1fvE1s = internal global {{.*}} { i32 12 }
+ static const S s = { 12 };
+ return ++s.n;
+}
OpenPOWER on IntegriCloud