Boost C++ Libraries: Ticket #11112: CS identifier causes compilation failure in geometry/test/strategies/distance_default_result.cpp https://svn.boost.org/trac10/ticket/11112 <ol><li>Description of the failure. </li></ol><blockquote> <p> geometry/test/strategies/distance_default_result.cpp fails with Oracle Studio 12.4 C++ compiler on Solaris producing error message similar to this: </p> </blockquote> <blockquote> <blockquote> <p> "CC" -library=stlport4 -xO4 -mt -erroff=%none -KPIC -DBOOST_ALL_NO_LIB=1 -DNDEBUG -I"." -I"../../.." -I"../../../boost/geometry/extensions/contrib/ttmath" -c -o "../../../bin.v2/libs/geometry/test/strategies/distance_default_result.test/sun/release/stdlib-sun-stlport/threading-multi/distance_default_result.o" "strategies/distance_default_result.cpp" </p> </blockquote> </blockquote> <p> "strategies/distance_default_result.cpp", line 183: Error: "," expected instead of "15". </p> <ol start="2"><li>Cause of the failure. </li></ol><p> The code of this test is perfectly fine from language standpoint, and the failure is related to long-existing bug in all later Solaris versions. Basically, compilation of any C or C++ code will fail on Solaris if it will satisfy two conditions: </p> <ul><li>The presence of #include &lt;sys/regset.h&gt; system header, direct or indirectly attached through other system headers from /usr/include directory. </li></ul><ul><li>The presence of identifiers which accidentally coincide with X86 register names, like CS, DS, ES, ... </li></ul><p> Here is an example of such 2 lines code: </p> <p> #include &lt;sys/regset.h&gt; </p> <p> template &lt;unsigned D, typename CS&gt; inline void test_segment_all() {}; </p> <p> its compilation will produce error message similar to the one shown above. The failure occurs because that /usr/include/sys/regset.h has the following macros: </p> <p> #define CS 15 </p> <p> #define DS 3 </p> <p> #define ES 2 </p> <p> and when compiler preprocesses this header, after that it automatically replaces user identifiers which accidentally have the same names with those numbers shown above. </p> <p> So, in the original test &lt;sys/regset.h&gt; has been attached indirectly through long chain of system headers defined inside STL library with the usage of -library=stlport4 option, and when finally compiler preprocesses code from the test shown below: </p> <p> template &lt;std::size_t D, typename CS&gt; <em> Line 183 it wrongly replaces CS with '15' assuming that it comes from macro defined inside sys/regset.h </em></p> <ol start="3"><li>Possible Solution. </li></ol><p> To replace CS identifier inside geometry/test/strategies/distance_default_result.cpp with any other similar name, like for example C_S. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11112 Trac 1.4.3 Sergey.Sprogis@… Fri, 13 Mar 2015 02:30:39 GMT <link>https://svn.boost.org/trac10/ticket/11112#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11112#comment:1</guid> <description> <p> Also, please perform exactly the same CS to C_S replacement in one more test: libs/geometry/test/geometries/segment.cpp </p> </description> <category>Ticket</category> </item> <item> <dc:creator>awulkiew</dc:creator> <pubDate>Tue, 24 Mar 2015 01:26:06 GMT</pubDate> <title>status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/11112#comment:2 https://svn.boost.org/trac10/ticket/11112#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">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.58.0</span> </li> </ul> Ticket