aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 24655b8..2bcca5e 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -5529,12 +5529,14 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D,
T = D->getType();
if (getLangOpts().CPlusPlus) {
- if (InitDecl->hasFlexibleArrayInit(getContext()))
- ErrorUnsupported(D, "flexible array initializer");
Init = EmitNullConstant(T);
-
if (!IsDefinitionAvailableExternally)
NeedsGlobalCtor = true;
+ if (InitDecl->hasFlexibleArrayInit(getContext())) {
+ ErrorUnsupported(D, "flexible array initializer");
+ // We cannot create ctor for flexible array initializer
+ NeedsGlobalCtor = false;
+ }
} else {
ErrorUnsupported(D, "static initializer");
Init = llvm::UndefValue::get(getTypes().ConvertType(T));