Boost C++ Libraries: Ticket #6754: [result_of] Test fails on clang trunk and gcc-4.7 https://svn.boost.org/trac10/ticket/6754 <p> In C++11, when a function call expression <code>EXPR</code> is a prvalue of non-class types, <code>decltype(EXPR)</code> does not have cv-qualifiers. This is because </p> <ul><li><code>decltype(EXPR)</code>is the type of <code>EXPR</code> when a function call expression <code>EXPR</code> is a prvalue; </li><li> a prvalue of non-class types is never cv-qualified. </li></ul><p> So, for "<code>const int f();</code>", <code>decltype(f())</code> is <code>int</code>. </p> <p> Because this rule was introduced at the last minute of the C++11 standardization process, only a few compilers implement it for now: clang trunk (which will be clang-3.1) and gcc-4.7. On those compilers in a C++11 mode, the test fails with the following errors. </p> <ol><li>result_of_test.cpp:210:3: error: static assertion failed: <pre class="wiki">(is_same&lt;result_of&lt;const result_of_member_function_template(double)&gt;::type, const double&gt;::value) </pre></li><li>result_of_test.cpp:211:3: error: static assertion failed: <pre class="wiki">(is_same&lt;result_of&lt;volatile result_of_member_function_template(double)&gt;::type, volatile double&gt;::value) </pre></li><li>result_of_test.cpp:212:3: error: static assertion failed: <pre class="wiki">(is_same&lt;result_of&lt;const volatile result_of_member_function_template(double)&gt;::type, const volatile double&gt;::value) </pre></li><li>result_of_test.cpp:239:3: error: static assertion failed: <pre class="wiki">(is_same&lt;result_of&lt;const volatile no_result_type_or_result_of(void)&gt;::type, const unsigned short&gt;::value) </pre></li><li>result_of_test.cpp:244:3: error: static assertion failed: <pre class="wiki">(is_same&lt;result_of&lt;const volatile no_result_type_or_result_of_template&lt;void&gt;(void)&gt;::type, const unsigned short&gt;::value) </pre></li></ol> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6754 Trac 1.4.3 Daniel Walker Sat, 01 Sep 2012 20:12:03 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6754#comment:1 https://svn.boost.org/trac10/ticket/6754#comment:1 <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> These test cases are checking that result_of uses the appropriate operator() when there are cv-overloads by using cv-qualification on the return type as a flag. I replaced the return types with a wrapper, cv_overoad_check, that is used to signal which overload was used. Fixed in <a class="changeset" href="https://svn.boost.org/trac10/changeset/80352" title="Fixes [6754]. Minor edits to documentation.">[80352]</a>. </p> Ticket Michel Morin Sun, 02 Sep 2012 00:29:14 GMT <link>https://svn.boost.org/trac10/ticket/6754#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6754#comment:2</guid> <description> <p> Confirmed the fix. The test ran fine on gcc 4.7, 4.8 (experimental) and clang 3.1, 3.2 (trunk). Thanks for the fix, Daniel. </p> </description> <category>Ticket</category> </item> </channel> </rss>