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 | 2d1c055eba74cba5c024240e498c7f57bbec3c7b (patch) | |
tree | 99153b3a216d9dd0b454e6c54dfa70cbba290c8b /clang/test/CodeGenCXX/global-llvm-constant.cpp | |
parent | c132174169cc694d497304b151c67640ee05f808 (diff) | |
download | bcm5719-llvm-2d1c055eba74cba5c024240e498c7f57bbec3c7b.tar.gz bcm5719-llvm-2d1c055eba74cba5c024240e498c7f57bbec3c7b.zip |
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>.
llvm-svn: 131060
Diffstat (limited to 'clang/test/CodeGenCXX/global-llvm-constant.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/global-llvm-constant.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/global-llvm-constant.cpp b/clang/test/CodeGenCXX/global-llvm-constant.cpp index ef1dcf0c59b..b23337d634c 100644 --- a/clang/test/CodeGenCXX/global-llvm-constant.cpp +++ b/clang/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 }; |