rnk accepted this revision. rnk added a comment. This revision is now accepted and ready to land.
lgtm ================ Comment at: lib/CodeGen/CGDeclCXX.cpp:470-471 PrioritizedCXXGlobalInits.push_back(std::make_pair(Key, Fn)); - } else if (isTemplateInstantiation(D->getTemplateSpecializationKind())) { + } else if (isTemplateInstantiation(D->getTemplateSpecializationKind()) || + getContext().GetGVALinkageForVariable(D) == GVA_DiscardableODR) { // C++ [basic.start.init]p2: ---------------- I think this can be simplified by removing the `isTemplateInstantiation` check and then checking for GVA_DiscardableODR or GVA_StrongODR. That will handle the cases of explicit template instantiation that you have below. It's up to you if you want to implement the simplification. The current code is correct, I don't believe it's possible to create a GVA_StrongODR global variable with a dynamic initializer without template instantiation (phew). CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60912/new/ https://reviews.llvm.org/D60912 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits