aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-09-03 18:58:50 +0000
committerJohn McCall <rjmccall@apple.com>2010-09-03 18:58:50 +0000
commit9c20fa9d46645480872f239a2fc631996ba7dc23 (patch)
treed59f497820d5aab333db66e2efb44968f96935b0 /lib/CodeGen/CGDecl.cpp
parentaaa80b208de3e2c706badf45060bd126fa747b84 (diff)
A constant initializer never matches the type of the variable it's
initializing; it at best matches the element type of the variable it's initializing. Fixes PR8073. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112992 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r--lib/CodeGen/CGDecl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index 8ce196b64e..5017ce720c 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -203,7 +203,7 @@ CodeGenFunction::AddInitializerToGlobalBlockVarDecl(const VarDecl &D,
// the global to match the initializer. (We have to do this
// because some types, like unions, can't be completely represented
// in the LLVM type system.)
- if (GV->getType() != Init->getType()) {
+ if (GV->getType()->getElementType() != Init->getType()) {
llvm::GlobalVariable *OldGV = GV;
GV = new llvm::GlobalVariable(CGM.getModule(), Init->getType(),