title: Is this a valid way of performing "Expression SFINAE" in C++03?
body: <p>In C++11, it is easy to SFINAE on whether or not an expression is valid. As an example, imagine checking if something is streamable:</p>
  
  <pre><code>template &lt;typename T&gt;
  auto print_if_possible(std::ostream&amp; os, const T&amp; x) 
      -&gt; decltype(os &lt;&lt; x, void());
  </code></pre>
  
  <p><code>print_if_possible</code> will only participate in <em>overload resolution</em> if <code>os &lt;&lt; x</code> is a well-formed expression.</p>
  
  <p><a href="https://gcc.godbolt.org/z/4xX8u5" rel="noreferrer"><strong>live example on godbolt.org</strong></a></p>
  
  <hr>
  
  <p>I need to do the same in C++03, and I figured out that <code>sizeof</code> could help (as I needed an unevaluated context for an expression). This is what I came up with:</p>
  
  <pre><code>template &lt;int&gt; struct sfinaer { };
  
  template &lt;typename T&gt;
  void print_if_possible(std::ostream&amp; os, const T&amp; x, 
      sfinaer&lt;sizeof(os &lt;&lt; x)&gt;* = NULL);
  </code></pre>
  
  <p><a href="https://gcc.godbolt.org/z/f8sYAm" rel="noreferrer"><strong>live example on godbolt.org</strong></a></p>
  
  <hr>
  
  <p>It seems that both the latest versions of <em>g++</em> and <em>clang++</em> accept the <code>sizeof</code> version with <code>-std=c++03 -Wall -Wextra</code>. </p>
  
  <ul>
  <li><p>Is the code guaranteed to work as intended in C++03?</p></li>
  <li><p>Is it correct to conclude that any usage of C++11 expression SFINAE can be backported to C++03 using <code>sfinaer</code> and <code>sizeof</code>? </p></li>
  </ul>