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

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 29 16:31:46 PST 2022


efriedma added a comment.

That's roughly what I was thinking, yes.

The one missing piece is the code to modify the constructor priorities to make sure that "constant" variables get initialized first.  (This ensures we honor the C++ rules for "constant initialization".)



================
Comment at: clang/lib/Sema/SemaDecl.cpp:13896
+          Diag(var->getLocation(), diag::err_constexpr_var_requires_const_init)
+              << var << Init->getSourceRange();
+      }
----------------
I don't understand why this diagnostic is necessary.


================
Comment at: clang/test/CodeGenCXX/PR19955.cpp:10
+// CHECK-DAG: @"?varp@@3PAHA" = dso_local global ptr @"?var@@3HA"
+// X64-DAG: @"?varp@@3PEAHEA" = dso_local global ptr @"?var@@3HA"
 
----------------
We probably want to continue using "null" as the placeholder here, to avoid any confusion.


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

https://reviews.llvm.org/D137107



More information about the cfe-commits mailing list