Boost C++ Libraries: Ticket #1051: MPL header ordering triggers bug https://svn.boost.org/trac10/ticket/1051 <p> If I include &lt;boost/mpl/map.hpp&gt; after a series of MPL headers, my build breaks. </p> <p> When attached source is compiled with X defined, I get the following error message: </p> <pre class="wiki">/usr/include/boost/mpl/map/aux_/contains_impl.hpp:31: error: ‘apply’ in class ‘boost::mpl::at_impl&lt;boost::mpl::aux::map_tag&gt;’ does not name a type /usr/include/boost/mpl/map/aux_/contains_impl.hpp:31: error: expected template-argument before ‘&lt;’ token /usr/include/boost/mpl/map/aux_/contains_impl.hpp:31: error: expected `&gt;' before ‘&lt;’ token /usr/include/boost/mpl/map/aux_/contains_impl.hpp:34: error: wrong number of template arguments (1, should be 2) /usr/include/boost/type_traits/is_same.hpp:37: error: provided for ‘template&lt;class T, class U&gt; struct boost::is_same’ /usr/include/boost/mpl/map/aux_/contains_impl.hpp:34: error: expected `{' before ‘type’ /usr/include/boost/mpl/map/aux_/contains_impl.hpp:35: error: invalid type in declaration before ‘,’ token /usr/include/boost/mpl/map/aux_/contains_impl.hpp:35: error: expected `;' before ‘,’ token /usr/include/boost/mpl/map/aux_/contains_impl.hpp:38: error: data member ‘type’ cannot be a member template /usr/include/boost/mpl/map/aux_/has_key_impl.hpp:33: error: ‘apply’ in class ‘boost::mpl::at_impl&lt;boost::mpl::aux::map_tag&gt;’ does not name a type /usr/include/boost/mpl/map/aux_/has_key_impl.hpp:33: error: expected template-argument before ‘&lt;’ token /usr/include/boost/mpl/map/aux_/has_key_impl.hpp:33: error: expected `&gt;' before ‘&lt;’ token /usr/include/boost/mpl/map/aux_/has_key_impl.hpp:33: error: template argument 1 is invalid /usr/include/boost/mpl/map/aux_/has_key_impl.hpp:33: error: expected `{' before ‘type’ /usr/include/boost/mpl/map/aux_/has_key_impl.hpp:34: error: expected initializer before ‘&gt;’ token /usr/include/boost/mpl/map/aux_/iterator.hpp:41: error: template argument 1 is invalid /usr/include/boost/mpl/map/aux_/iterator.hpp:41: error: template argument 1 is invalid /usr/include/boost/mpl/map/aux_/iterator.hpp:44: error: expected `{' before ‘&gt;’ token /usr/include/boost/mpl/map/aux_/iterator.hpp:44: error: expected unqualified-id before ‘&gt;’ token /usr/include/boost/mpl/map/aux_/iterator.hpp:62: error: expected nested-name-specifier before ‘item_by_order’ /usr/include/boost/mpl/map/aux_/iterator.hpp:62: error: expected ‘;’ before ‘&lt;’ token </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1051 Trac 1.4.3 aribrei@… Thu, 14 Jun 2007 22:16:09 GMT attachment set https://svn.boost.org/trac10/ticket/1051 https://svn.boost.org/trac10/ticket/1051 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test1.cpp</span> </li> </ul> <p> Compile with -DX to trigger failure </p> Ticket Dave Abrahams Wed, 11 Jul 2007 01:11:03 GMT owner set https://svn.boost.org/trac10/ticket/1051#comment:1 https://svn.boost.org/trac10/ticket/1051#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Aleksey Gurtovoy</span> </li> </ul> Ticket Steven Watanabe Thu, 05 Feb 2009 02:52:51 GMT <link>https://svn.boost.org/trac10/ticket/1051#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1051#comment:2</guid> <description> <p> I guess the solution is "don't do that." #define X or the equivalent -DX is a bad idea, as is defining any other such short name as a macro. </p> </description> <category>Ticket</category> </item> <item> <author>aribrei@…</author> <pubDate>Tue, 10 Feb 2009 12:29:19 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/1051#comment:3 https://svn.boost.org/trac10/ticket/1051#comment:3 <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> <p> I cannot reproduce the problem on 1.37, so it seems to be fixed, actually. But, Steven Watanabe is completely wrong, the #define X is not even related to the problem. When I reported the problem, the same error would appear without any such #define. Claiming "-DX is a bad idea" without even looking at the relevant code is a most stupid idea, as it could be easily seen from the code that "#ifdef X" was added for testing purposes. </p> <p> Also, if MPL would actually use X as a define internally without first checking for its existence, that would be a bug as well. Fortunately that is not the case, and never has been. </p> Ticket