title: If the address of a function can not be resolved during deduction, is it SFINAE or a compiler error?
body: <p>In C++0x SFINAE rules have been simplified such that any invalid expression or type that occurs in the "immediate context" of deduction does not result in a compiler error but rather in deduction failure (SFINAE).  </p>
  
  <p>My question is this:<br>
  If I take the address of an overloaded function and it can not be resolved, is that failure in the immediate-context of deduction?<br>
  (i.e is it a hard error or SFINAE if it can not be resolved)?</p>
  
  <p>Here is some sample code:</p>
  
  <pre><code>struct X
  {
    // template&lt;class T&gt; T* foo(T,T); // lets not over-complicate things for now
    void foo(char);
    void foo(int);
  };
  
  
  template&lt;class U&gt; struct S
  {
    template&lt;int&gt; struct size_map 
    { typedef int type; };
  
  
  // here is where we take the address of a possibly overloaded function
    template&lt;class T&gt; void f(T, 
        typename size_map&lt;sizeof(&amp;U::foo)&gt;::type* = 0); 
  
  
    void f(...);
  };
  
  int main()
  {
    S&lt;X&gt; s;
  
  // should this cause a compiler error because 'auto T = &amp;X::foo' is invalid?
    s.f(3);  
  
  }
  </code></pre>
  
  <p>Gcc 4.5 states that this is a compiler error, and clang spits out an assertion violation.</p>
  
  <p>Here are some more related questions of interest:  </p>
  
  <p>Does the FCD-C++0x clearly specify what should happen here?<br>
  Are the compilers wrong in rejecting this code?<br>
  Does the "immediate-context" of deduction need to be defined a little better?</p>
  
  <p>Thanks!</p>