Boost C++ Libraries: Ticket #3552: concatenation does not work with BOOST_PP_COMMA() with g++ https://svn.boost.org/trac10/ticket/3552 <p> The concatenation of a token with a comma does not work with g++ </p> <p> Example:<br /> </p> <pre class="wiki">cmd&gt;cat test.cpp #include &lt;boost/preprocessor/cat.hpp&gt; #include &lt;boost/preprocessor/punctuation/comma.hpp&gt; BOOST_PP_CAT(test,BOOST_PP_COMMA()) </pre><h3 class="section" id="gv3.4.4">g++ v3.4.4</h3> <pre class="wiki">cmd&gt;g++-3 --version g++-3 (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125) cmd&gt;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; </pre><h3 class="section" id="g4.3.2">g++ 4.3.2</h3> <pre class="wiki">cmd&gt;g++-4 --version g++-4 (GCC) 4.3.2 20080827 (beta) 2 cmd&gt;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; </pre><h3 class="section" id="WherasMSVisualStudio2005works">Wheras MS <a class="missing wiki">VisualStudio</a> 2005 works</h3> <pre class="wiki">cmd&gt;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, </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3552 Trac 1.4.3 Steven Watanabe Fri, 30 Oct 2009 01:01:30 GMT <link>https://svn.boost.org/trac10/ticket/3552#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3552#comment:1</guid> <description> <p> I don't think that BOOST_PP_COMMA is intended to be used in this way. The example given in the documentation is </p> <pre class="wiki">BOOST_PP_IF(1, BOOST_PP_COMMA, BOOST_PP_EMPTY)() </pre><p> which does not depend on the order of macro expansion. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Daniel James</dc:creator> <pubDate>Thu, 25 Mar 2010 20:47:26 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3552#comment:2 https://svn.boost.org/trac10/ticket/3552#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> You can't concatenate with a comma in the C preprocessor since concatenation has to create a single token and <code>test,</code> is two tokens. The Visual C++ preprocessor is not following the standard when it allows it. There's not really any point in concatenating <code>test</code> and <code>BOOST_PP_COMMA</code>, since you can just write: </p> <pre class="wiki">test BOOST_PP_COMMA() </pre> Ticket