[libcxx-commits] [PATCH] D99641: [libcxx] [test] Fix invocable tests on Windows

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 31 05:12:19 PDT 2021

mstorsjo added a comment.

In D99641#2660761 <https://reviews.llvm.org/D99641#2660761>, @curdeius wrote:

> That's strange. I guess you use clang-cl (with some automatically set `-fms-compatibility`), right?
> It seems as if it uses compatibility for MSVC before version 19.28 (where this particular bug seems to have been fixed).
> Cf. https://godbolt.org/z/3bsEaPToc.
> Should these `#ifndef`s be precise about the version? Unfortunately I don't know if clang-cl correctly sets `_MSC_VER`.

Oh, interesting, thanks for digging into this!

clang-cl does try to set `_MSC_VER` (it can be controlled via a number of mechanisms, see https://github.com/llvm/llvm-project/blob/llvmorg-11.1.0/clang/lib/Driver/ToolChains/MSVC.cpp#L1340-L1355, it first checks for the options `-fmsc-version` and `-fms-compatibility-version`, then tries to see if there's a version number specified as part of the triple, then tries to locate a cl.exe in the PATH and extract a version number from it, and then finally defaults to 19.11.

However, for this particular issue here, Clang doesn't know about this change in behaviour yet, so regardless of targeted MSVC version, Clang mimics the old buggy behaviour.

I guess I could at least amend the ifdef with a comment mentioning this detail.

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list