title: How to use decltype with member functions
body: <p>I'm trying to use decltype on member functions in Visual Studio 2012. I've stumbled upon a peculiarity and I'm wondering if this is intention or if it is a compiler bug. Consider (just a code snippet without meaning to show my point):</p>
  
  <pre><code>struct Test { int f() {return 0;} } T;
  std::integral_constant&lt;decltype(T.f()), 5&gt;;
  std::integral_constant&lt;decltype(&amp;Test::f), 5&gt;; // error C2440
  </code></pre>
  
  <p>While the second line compiles, the third gives an error C2440: 'specialization' : cannot convert from 'int' to 'int (__thiscall Test::*)(void)'</p>
  
  <p>How come decltype on an instanciated call to a function yields its return type (this is what I am expecting), however trying to do the same without any member involved does yield a member function pointer? If this is the intended behavior, what is the reasoning behind it? How would I denote that I'm requesting the return type of a member function, without actually having an instance at hand? Of course I could do it the dirty way:</p>
  
  <pre><code>std::integral_constant&lt;decltype(((Test*)nullptr)-&gt;f()), 5&gt;;
  </code></pre>
  
  <p>But unquestionable this is pretty, pretty ugly and there should be a clean, straightforward C++ way to express this.</p>