diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-05-07 22:06:45 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-05-07 22:06:45 +0000 |
commit | da55074866ca2fe7f718c5d3334648d6e340fb15 (patch) | |
tree | aef4e95b1097d07fc114db78c6705d23f07f7d05 /test/CodeGenCXX/global-llvm-constant.cpp | |
parent | 6f0877744517fa1daf3ac9d2e5c63c9acfcfa562 (diff) |
In C++, allow us to emit a global as 'constant' even if it has class
type, so long as it is known to have a constant initializer and the
class type is a POD class. Fixes <rdar://problem/9306265>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131060 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/global-llvm-constant.cpp')
-rw-r--r-- | test/CodeGenCXX/global-llvm-constant.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/CodeGenCXX/global-llvm-constant.cpp b/test/CodeGenCXX/global-llvm-constant.cpp index ef1dcf0c59..b23337d634 100644 --- a/test/CodeGenCXX/global-llvm-constant.cpp +++ b/test/CodeGenCXX/global-llvm-constant.cpp @@ -8,3 +8,13 @@ struct A { const A x; // CHECK: @_ZL1x = internal global + +struct X { + int (*fp)(int, int); +}; + +int add(int x, int y) { return x + y; } + +// CHECK: @x2 = constant +extern const X x2; +const X x2 = { &add }; |