Opened 13 years ago
Closed 13 years ago
#3552 closed Support Requests (invalid)
concatenation does not work with BOOST_PP_COMMA() with g++
Reported by: | Owned by: | No-Maintainer | |
---|---|---|---|
Milestone: | Boost 1.41.0 | Component: | preprocessor |
Version: | Boost 1.40.0 | Severity: | Problem |
Keywords: | Cc: |
Description
The concatenation of a token with a comma does not work with g++
Example:
cmd>cat test.cpp #include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/punctuation/comma.hpp> BOOST_PP_CAT(test,BOOST_PP_COMMA())
g++ v3.4.4
cmd>g++-3 --version g++-3 (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125) cmd>g++-3 -E -P -I D:\Development\boost\1.40.0 test.cpp test.cpp:3:35: macro "BOOST_PP_CAT_I" passed 3 arguments, but takes just 2 BOOST_PP_CAT_I;
g++ 4.3.2
cmd>g++-4 --version g++-4 (GCC) 4.3.2 20080827 (beta) 2 cmd>g++-4 -E -P -I D:\Development\boost\1.40.0 test.cpp test.cpp:3:35: error: macro "BOOST_PP_CAT_I" passed 3 arguments, but takes just 2 BOOST_PP_CAT_I;
Wheras MS VisualStudio 2005 works
cmd>cl /E -I D:\Development\boost\1.40.0 test.cpp Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. ... #line 3 "test6.cpp" test,
Change History (2)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
You can't concatenate with a comma in the C preprocessor since concatenation has to create a single token and test,
is two tokens. The Visual C++ preprocessor is not following the standard when it allows it. There's not really any point in concatenating test
and BOOST_PP_COMMA
, since you can just write:
test BOOST_PP_COMMA()
Note:
See TracTickets
for help on using tickets.
I don't think that BOOST_PP_COMMA is intended to be used in this way. The example given in the documentation is
which does not depend on the order of macro expansion.