[PATCH] D137107: Allow MS extension: support of constexpr with __declspec(dllimport).

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 5 14:00:47 PST 2022


efriedma added a comment.

(-Wglobal-constructors warning is still not implemented.)



================
Comment at: clang/lib/CodeGen/CGDeclCXX.cpp:572
     PrioritizedCXXGlobalInits.push_back(std::make_pair(Key, Fn));
+  } else if (D->hasConstantInitialization() && !(D->hasAttr<ConstInitAttr>())) {
+    OrderGlobalInitsOrStermFinalizers Key(201,
----------------
How is ConstInitAttr relevant here?


================
Comment at: clang/test/Sema/dllimport.c:41
 // Address of variables can't be used for initialization in C language modes.
-int *VarForInit = &GlobalDecl; // expected-error{{initializer element is not a compile-time constant}}
+int *VarForInit = &GlobalDecl;
 
----------------
Like I mentioned before, we might want to restrict this feature to C++.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137107/new/

https://reviews.llvm.org/D137107



More information about the cfe-commits mailing list