diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-05-13 01:05:07 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-05-13 01:05:07 +0000 |
commit | 2bb110125e0e5adb7c1c65d12adfa34151ca1c47 (patch) | |
tree | 1d4cb0d79515f17727be015af2aa4d6a2936f95d /test/CodeGenCXX/global-llvm-constant.cpp | |
parent | 7880bc34fd5818d8f1eb827fdce136c1de643ab5 (diff) |
When determining whether we can make a declaration into a global
constant, also consider whether it's a class type that has any mutable
fields. If so, it can't be a global constant.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131276 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/global-llvm-constant.cpp')
-rw-r--r-- | test/CodeGenCXX/global-llvm-constant.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/CodeGenCXX/global-llvm-constant.cpp b/test/CodeGenCXX/global-llvm-constant.cpp index b23337d634..2bd43b99a5 100644 --- a/test/CodeGenCXX/global-llvm-constant.cpp +++ b/test/CodeGenCXX/global-llvm-constant.cpp @@ -18,3 +18,15 @@ int add(int x, int y) { return x + y; } // CHECK: @x2 = constant extern const X x2; const X x2 = { &add }; + +struct X1 { + mutable int i; +}; + +struct X2 { + X1 array[3]; +}; + +// CHECK: @x2b = global +extern const X2 x2b; +const X2 x2b = { { { 1 }, { 2 }, { 3 } } }; |