[clang] [clang-cl] [Sema] Support MSVC non-const lvalue to user-defined temporary reference (PR #99833)

Max Winkler via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 2 23:11:02 PST 2024


================
@@ -7272,6 +7272,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
     CmdArgs.push_back("-fdelayed-template-parsing");
   }
 
+  if (Args.hasFlag(options::OPT_fms_reference_binding,
+                   options::OPT_fno_ms_reference_binding,
+                   IsWindowsMSVC && !HaveCxx20))
----------------
MaxEW707 wrote:

I am not quite following. I modelled this flag similar to how we do other ms flags such as `-fms-extensions` and `-fdelayed-template-parsing`. That is it is enabled by cl driver options or enabled by default for MSVC targets.
It is still valid for you to explicitly do `-fms-extensions` on non-msvc targets if you want those behaviours for reasons.

When porting some old MSVC only games to certain console manufacturers it was common to use `-fms-extensions` and friends to get it building on their vendor clang :).

https://github.com/llvm/llvm-project/pull/99833


More information about the cfe-commits mailing list