[PATCH] D105518: [clang] disable P2266 simpler implicit moves under -fms-compatibility

Matheus Izvekov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 6 17:39:02 PDT 2021


mizvekov updated this revision to Diff 356844.
mizvekov added a comment.

.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105518

Files:
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/lib/Sema/SemaStmt.cpp


Index: clang/lib/Sema/SemaStmt.cpp
===================================================================
--- clang/lib/Sema/SemaStmt.cpp
+++ clang/lib/Sema/SemaStmt.cpp
@@ -3334,7 +3334,8 @@
     return NamedReturnInfo();
   NamedReturnInfo Res = getNamedReturnInfo(VD);
   if (Res.Candidate && !E->isXValue() &&
-      (ForceCXX2b || getLangOpts().CPlusPlus2b)) {
+      (ForceCXX2b ||
+       (getLangOpts().CPlusPlus2b && !getLangOpts().MSVCCompat))) {
     E = ImplicitCastExpr::Create(Context, VD->getType().getNonReferenceType(),
                                  CK_NoOp, E, nullptr, VK_XValue,
                                  FPOptionsOverride());
Index: clang/lib/Frontend/InitPreprocessor.cpp
===================================================================
--- clang/lib/Frontend/InitPreprocessor.cpp
+++ clang/lib/Frontend/InitPreprocessor.cpp
@@ -598,7 +598,8 @@
   }
   // C++2b features.
   if (LangOpts.CPlusPlus2b) {
-    Builder.defineMacro("__cpp_implicit_move", "202011L");
+    if (!LangOpts.MSVCCompat)
+      Builder.defineMacro("__cpp_implicit_move", "202011L");
     Builder.defineMacro("__cpp_size_t_suffix", "202011L");
   }
   if (LangOpts.Char8)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105518.356844.patch
Type: text/x-patch
Size: 1178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210707/f29d9882/attachment.bin>


More information about the cfe-commits mailing list