================
@@ -5341,6 +5341,15 @@ void CodeGenModule::EmitGlobalVarDefinition(const 
VarDecl *D,
       !IsDefinitionAvailableExternally &&
       D->needsDestruction(getContext()) == QualType::DK_cxx_destructor;
 
+  // It is helpless to emit the definition for an available_externally variable
+  // which can't be marked as const.
+  // We don't need to check if it needs global ctor or dtor. See the above
+  // comment for ideas.
+  if (IsDefinitionAvailableExternally &&
+      (!D->hasConstantInitialization() ||
+       !D->getType().isConstantStorage(getContext(), true, true)))
----------------
efriedma-quic wrote:

No, I mean, please make sure we don't emit an available_externally definition 
in that case.

https://github.com/llvm/llvm-project/pull/93530
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to