Boost C++ Libraries: Ticket #6631: BOOST_PP_ITERATION_FLAGS(): error: missing binary operator before token "(" https://svn.boost.org/trac10/ticket/6631 <p> With Boost 1.49.0 and GCC, use of BOOST_PP_ITERATION_FLAGS() results in a compiler error: </p> <pre class="wiki"># g++ -I $HOME/usr/rhel6-x86_64/boost_1_49_0/include -I. -o file -O2 file.cpp In file included from file.cpp:1:0: file.h:19:1: error: missing binary operator before token "(" file.h:24:1: error: missing binary operator before token "(" </pre><p> As a reproducable test case, I compiled the example given in the Boost.Preprocessor documentation: </p> <pre class="wiki">// file.h #if !BOOST_PP_IS_ITERATING #ifndef FILE_H_ #define FILE_H_ #include &lt;boost/preprocessor/iteration/iterate.hpp&gt; // 1st iteration: #define BOOST_PP_ITERATION_PARAMS_1 (4, (1, 10, "file.h", 0x0001)) #include BOOST_PP_ITERATE() // 2nd iteration: #define BOOST_PP_ITERATION_PARAMS_1 (4, (1, 10, "file.h", 0x0002)) #include BOOST_PP_ITERATE() #endif #elif BOOST_PP_ITERATION_DEPTH() == 1 \ &amp;&amp; BOOST_PP_ITERATION_FLAGS() == 0x0001 \ /**/ #elif BOOST_PP_ITERATION_DEPTH() == 1 \ &amp;&amp; BOOST_PP_ITERATION_FLAGS() == 0x0002 \ /**/ #endif </pre><pre class="wiki">// file.cpp #include "file.h" int main() {} </pre><p> Both GCC 4.4 and GCC 4.6 fail to compile the example using Boost 1.49.0. </p> <p> The above code compiles fine using Boost 1.48.0. </p> <p> g++ (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3) </p> <p> g++ (GCC) 4.6.2 20110728 (prerelease) </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6631 Trac 1.4.3 Blake-R <blake-r@…> Tue, 06 Mar 2012 05:20:26 GMT cc set https://svn.boost.org/trac10/ticket/6631#comment:1 https://svn.boost.org/trac10/ticket/6631#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">blake-r@…</span> added </li> </ul> Ticket patrick.hartling@… Tue, 06 Mar 2012 15:17:26 GMT <link>https://svn.boost.org/trac10/ticket/6631#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6631#comment:2</guid> <description> <p> Modifying <code>file.h</code> to be the following fixes the problem for me (testing with GCC 4.4 and Visual C++ 9.0 SP1): </p> <pre class="wiki">// file.h #if !BOOST_PP_IS_ITERATING #ifndef FILE_H_ #define FILE_H_ #include &lt;boost/preprocessor/iteration/iterate.hpp&gt; // 1st iteration: #define BOOST_PP_ITERATION_PARAMS_2 (4, (1, 10, "file.h", 0x0001)) #include BOOST_PP_ITERATE() // 2nd iteration: #define BOOST_PP_ITERATION_PARAMS_1 (4, (1, 10, "file.h", 0x0002)) #include BOOST_PP_ITERATE() #endif #else #if BOOST_PP_ITERATION_DEPTH() == 1 \ &amp;&amp; BOOST_PP_ITERATION_FLAGS() == 0x0001 \ /**/ struct BOOST_PP_CAT(Y, BOOST_PP_ITERATION()) { }; #elif BOOST_PP_ITERATION_DEPTH() == 1 \ &amp;&amp; BOOST_PP_ITERATION_FLAGS() == 0x0002 \ /**/ struct BOOST_PP_CAT(Z, BOOST_PP_ITERATION()) { }; #endif #endif </pre><p> The difference in structure is like this: </p> <pre class="wiki">#if !BOOST_PP_IS_ITERATING // ... #else #if BOOST_PP_ITERATION_DEPTH() == 1 \ &amp;&amp; BOOST_PP_ITERATION_FLAGS() == 0x0001 \ /**/ // ... #endif #endif </pre> </description> <category>Ticket</category> </item> <item> <author>Blake-R <blake-r@…></author> <pubDate>Wed, 07 Mar 2012 04:15:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6631#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6631#comment:3</guid> <description> <p> Yes, it helps. But me interesting why? </p> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/6631#comment:2" title="Comment 2">patrick.hartling@…</a>: </p> <blockquote class="citation"> <p> Modifying <code>file.h</code> to be the following fixes the problem for me (testing with GCC 4.4 and Visual C++ 9.0 SP1): </p> <pre class="wiki">// file.h #if !BOOST_PP_IS_ITERATING #ifndef FILE_H_ #define FILE_H_ #include &lt;boost/preprocessor/iteration/iterate.hpp&gt; // 1st iteration: #define BOOST_PP_ITERATION_PARAMS_2 (4, (1, 10, "file.h", 0x0001)) #include BOOST_PP_ITERATE() // 2nd iteration: #define BOOST_PP_ITERATION_PARAMS_1 (4, (1, 10, "file.h", 0x0002)) #include BOOST_PP_ITERATE() #endif #else #if BOOST_PP_ITERATION_DEPTH() == 1 \ &amp;&amp; BOOST_PP_ITERATION_FLAGS() == 0x0001 \ /**/ struct BOOST_PP_CAT(Y, BOOST_PP_ITERATION()) { }; #elif BOOST_PP_ITERATION_DEPTH() == 1 \ &amp;&amp; BOOST_PP_ITERATION_FLAGS() == 0x0002 \ /**/ struct BOOST_PP_CAT(Z, BOOST_PP_ITERATION()) { }; #endif #endif </pre><p> The difference in structure is like this: </p> <pre class="wiki">#if !BOOST_PP_IS_ITERATING // ... #else #if BOOST_PP_ITERATION_DEPTH() == 1 \ &amp;&amp; BOOST_PP_ITERATION_FLAGS() == 0x0001 \ /**/ // ... #endif #endif </pre></blockquote> </description> <category>Ticket</category> </item> <item> <author>Steve Robbins <smr@…></author> <pubDate>Sun, 11 Mar 2012 03:41:16 GMT</pubDate> <title>cc changed https://svn.boost.org/trac10/ticket/6631#comment:4 https://svn.boost.org/trac10/ticket/6631#comment:4 <ul> <li><strong>cc</strong> <span class="trac-author">smr@…</span> added </li> </ul> <p> I am currently investigating building all Debian packages with Boost 1.49 and "luabind" fails to build with very similar symptoms. Can the boost maintainer comment whether this is a bug in boost or a simple API break. </p> <p> Thanks, -Steve </p> Ticket peter@… Fri, 16 Mar 2012 15:02:59 GMT <link>https://svn.boost.org/trac10/ticket/6631#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6631#comment:5</guid> <description> <p> This is the follow-up on the mailing list: </p> <p> <a class="ext-link" href="http://thread.gmane.org/gmane.comp.lib.boost.devel/228802"><span class="icon">​</span>http://thread.gmane.org/gmane.comp.lib.boost.devel/228802</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Edward Diener</dc:creator> <pubDate>Sun, 17 May 2015 03:22:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6631#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6631#comment:6</guid> <description> <p> The thread explains the issue involved as a gcc problem. Therefore I am going to close it. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Edward Diener</dc:creator> <pubDate>Sun, 17 May 2015 03:22:11 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/6631#comment:7 https://svn.boost.org/trac10/ticket/6631#comment:7 <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">fixed</span> </li> </ul> Ticket