Boost C++ Libraries: Ticket #2407: [Proto] Error while using operator<< and iostream https://svn.boost.org/trac10/ticket/2407 <p> Bug found in the "[Boost-users] [Proto] Strange behavior with semantic action and custom tag function" threads. </p> <p> Quoting Eric : "The operator&lt;&lt; in the output expression can potentially match either the ostream inserter we've defined above or Proto's operator&lt;&lt;. Proto's operator overload *should* be disabled with SFINAE because the resulting expression type doesn't match the domain's grammar. But the failure happens before we get that far. Before checking the return type against the grammar, Proto first calculates the return type, which first involves Protofying std::cout, resulting in e&lt;proto::terminal&lt;std::ostream &amp;&gt;::type&gt;. This is where the failure occurs because this simple terminal expression *also* doesn't match the grammar. That triggers the static assertion failure in e&lt;&gt;." </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2407 Trac 1.4.3 Eric Niebler Mon, 13 Oct 2008 00:39:20 GMT status changed; owner set https://svn.boost.org/trac10/ticket/2407#comment:1 https://svn.boost.org/trac10/ticket/2407#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Eric Niebler</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/proto/proto.hpp&gt; namespace mpl = boost::mpl; namespace proto = boost::proto; using proto::_; template&lt;class E&gt; struct e; struct g : proto::or_&lt; proto::terminal&lt;int&gt; , proto::plus&lt;g,g&gt; &gt; {}; struct d : proto::domain&lt;proto::generator&lt;e&gt;, g&gt; {}; template&lt;class E&gt; struct e : proto::extends&lt;E, e&lt;E&gt;, d&gt; { BOOST_MPL_ASSERT((proto::matches&lt;E, g&gt;)); e(E const &amp;x = E()) : proto::extends&lt;E, e&lt;E&gt;, d&gt;(x) {} }; e&lt;proto::terminal&lt;int&gt;::type&gt; i; template&lt;class E&gt; std::ostream &amp;operator&lt;&lt;(std::ostream &amp;sout, e&lt;E&gt; const &amp;x) { return sout; } int main() { std::cout &lt;&lt; (i+i); } </pre> Ticket Eric Niebler Mon, 13 Oct 2008 01:33:30 GMT component changed https://svn.boost.org/trac10/ticket/2407#comment:2 https://svn.boost.org/trac10/ticket/2407#comment:2 <ul> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">proto</span> </li> </ul> Ticket Eric Niebler Sun, 16 Nov 2008 23:22:54 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/2407#comment:3 https://svn.boost.org/trac10/ticket/2407#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/49812" title="fix #2407">[49812]</a>) fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2407" title="#2407: Bugs: [Proto] Error while using operator&lt;&lt; and iostream (closed: fixed)">#2407</a> </p> Ticket Eric Niebler Tue, 18 Nov 2008 03:03:47 GMT <link>https://svn.boost.org/trac10/ticket/2407#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2407#comment:4</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/49820" title="fix bug 2407">[49820]</a>) fix bug 2407 </p> </description> <category>Ticket</category> </item> </channel> </rss>