[llvm-bugs] [Bug 51610] New: In certain cases `__VA_OPT__` incorectly expands to nothing when `-fms-compatibility` is present

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 24 15:04:45 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51610

            Bug ID: 51610
           Summary: In certain cases `__VA_OPT__` incorectly expands to
                    nothing when `-fms-compatibility` is present
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: blckcat at inbox.ru
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Clang with no flags successfully compiles following code:
    #define CHECK_COMMA(...) CHECK_COMMA_(__VA_ARGS__,)
    #define CHECK_COMMA_(x, ...) (__VA_OPT__(1) + 0)
    static_assert(!CHECK_COMMA());
    static_assert(CHECK_COMMA(,));

But if you add `-fms-compatibility`, the second assert fails.

This doesn't match the behavior of MSVC. MSVC v19.29 (VS16.11) with `/std:c++20
/Zc:preprocessor` compiles it successfully, and if you disable the
standard-conformant preprocessor the first assertion fails.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210824/30bf2fd0/attachment.html>


More information about the llvm-bugs mailing list