[llvm-bugs] [Bug 27382] New: Another clang-cl preprocessor error in expansion where VC++ works
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Apr 16 01:09:19 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27382
Bug ID: 27382
Summary: Another clang-cl preprocessor error in expansion where
VC++ works
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: eldlistmailingz at tropicsoft.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Classification: Unclassified
This bug report illustrates another clang-cl preprocessor error where VC++
compiles without any error, found when testing the Boost preprocessor library.
The code is a simplified version of the Boost PP problem when compiling with
clang-cl:
#define TEST_EXPAND(x) TEST_EXPAND_I(x)
#define TEST_EXPAND_I(x) x
#define TEST_REM(...) __VA_ARGS__
#define TEST_CAT(a, b) TEST_CAT_I(a, b)
#define TEST_CAT_I(a, b) a ## b
#define TEST_ELEM(n, ...) TEST_ELEM_I(n,__VA_ARGS__)
#define TEST_ELEM_I(n, ...) TEST_CAT(TEST_CAT(TEST_ELEM_, n)(__VA_ARGS__,),)
#define TEST_ELEM_0(e0, ...) e0
#define TEST_ELEM_1(e0, e1, ...) e1
#define TEST_MACRO(x,y) TEST_ELEM(x, TEST_EXPAND(TEST_REM y))
int main()
{
int x = TEST_MACRO(1,(1,0));
return x;
}
------------------------------------------------------------------------------
When compiled with clang-cl the result is:
test_clang2.cpp(17,29): error: too many arguments provided to function-like
macro invocation
int x = TEST_MACRO(1,(1,0));
^
test_clang2.cpp(2,9): note: macro 'TEST_EXPAND_I' defined here
#define TEST_EXPAND_I(x) x
^
test_clang2.cpp(17,32): error: expected expression
int x = TEST_MACRO(1,(1,0));
------------------------------------------------------------------------------
VC++ compiles the above without error.
The command line options for clang-cl are:
-TP /Od /Ob0 /W3 /GR /MDd /Zc:forScope /Zc:wchar_t -fmsc-version=1900 /wd4675
/EHs -fmacro-backtrace-limit=0 -Wno-invalid-token-paste -c
The command line options for the successful VC++ compile are:
/Zm800 -TP /Z7 /Od /Ob0 /W4 /GR /MDd /Zc:forScope /Zc:wchar_t /wd4675 /EHs -c
--
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/20160416/a0acffb0/attachment.html>
More information about the llvm-bugs
mailing list