https://bugs.llvm.org/show_bug.cgi?id=45005
Bug ID: 45005
Summary: Clang-CL's MSVC preprocessor emulation does not
properly handle variadic arguments
Product: clang
Version: 9.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: balazs.czir...@nng.com
CC: blitzrak...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@metafoo.co.uk
Clang-CL's MSVC preprocessor emulation does not produce the exact same behavior
as MSVC's preprocessor, which breaks certain libraries that are prepared to
handle MSVC's preprocessor behavior.
A minimal repro of the error that causes said libraries to break:
https://godbolt.org/z/c5RndM
(Clang-CL is not available on Godbolt, so the output of a local build was
pasted into a comment.)
The example macro `_NARG` counts the arguments it was provided up to three.
Since MSVC's preprocessor has it's quirks, the `_NARG_MSVC` macro is what can
produce the same behavior with that preprocessor.
When given two empty arguments, Clang-CL's preprocessor does not properly
handle the MSVC version, and produces an erroneous argument count of `1`.
This breaks libraries such as:
* GoogleMock: https://godbolt.org/z/noqbnj
(The new `MOCK_METHOD` macro in 1.10)
* Boost Preprocessor: https://godbolt.org/z/NL6BbA
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs