title: C++ decltype fails to deduce type
body: <p>Is decltype really buggy in Visual Studio 2012 or is it actually supposed to be this hard to use?</p>
  
  <p>Example:</p>
  
  <pre><code>namespace ptl
  {
  
      struct Test
      {
          Test(float ){}
      };
  
      template&lt;class T, class A0&gt;
      static T* static_constructor(void* p, A0 a0){return new(p) T(a0);}
  
      template&lt;class T&gt;
      T*  MakeVS2012Happy(T*);
  }
  
  inline auto ExampleFxn() -&gt; decltype(ptl::MakeVS2012Happy(&amp;ptl::static_constructor&lt;ptl::Test, float&gt;)) 
  {
     return &amp;ptl::static_constructor&lt;ptl::Test, float&gt;;
  }
  inline auto ExampleFxn2() -&gt; decltype(&amp;ptl::static_constructor&lt;ptl::Test, float&gt;)
  {
     return &amp;ptl::static_constructor&lt;ptl::Test, float&gt;;
  }
  </code></pre>
  
  <p>ExampleFxn compiles because I've wrapped the code in the decltype with that pointless function.</p>
  
  <p>ExampleFxn2 does not, VS2012 spits out the extremely helpful error message:</p>
  
  <p>error C3555: incorrect argument to 'decltype'</p>
  
  <p>Anyone know what causes this? I seem to constantly have to fight against decltype to get it to work as expected...</p>
  
  <p>Thanks</p>