summaryrefslogtreecommitdiffstats
path: root/clang/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
commit56f57589af29b9227aafbbbe7ee506f523c43c6a (patch)
tree1e4e9d2cea6087ccbe178be0b51e063cab0329a6 /clang/lib/CodeGen/CGDecl.cpp
parentcef985bc7eb8b003374ecc867aabc05e23ac57f3 (diff)
downloadbcm5719-llvm-56f57589af29b9227aafbbbe7ee506f523c43c6a.tar.gz
bcm5719-llvm-56f57589af29b9227aafbbbe7ee506f523c43c6a.zip
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. llvm-svn: 112992
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 8ce196b64e8..5017ce720cb 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/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(),
OpenPOWER on IntegriCloud