title: How to declare return type of C++ template method to be that of static method in other class?
body: <p>I want to do the valid C++11 equivalent of the following (apparently) invalid code:</p>
  
  <pre><code>class StaticMethodClass {
  public:
      static int staticMethod(int a) {return 0;}
  };
  
  #include &lt;type_traits&gt;
  
  template&lt;class T&gt; class ClassTemplate {
  public:
      decltype(T::staticMethod(int)) methodTemplate(int a);
  };
  
  template&lt;class T&gt;
  decltype(T::staticMethod(int)) ClassTemplate&lt;T&gt;::methodTemplate(int a) {
      return T::staticMethod(a);
  }
  
  template class ClassTemplate&lt;StaticMethodClass&gt;;
  </code></pre>
  
  <p>I get the following errors from my compiler:</p>
  
  <pre><code>/tmp$ g++ -std=c++11 -c a.cpp
  a.cpp:14:26: error: expected primary-expression before ‘int’
   decltype(T::staticMethod(int)) ClassTemplate&lt;T&gt;::methodTemplate(int a) {
                            ^
  a.cpp:14:32: error: prototype for ‘decltype (T:: staticMethod(&lt;expression error&gt;)) ClassTemplate&lt;T&gt;::methodTemplate(int)’ does not match any in class ‘ClassTemplate&lt;T&gt;’
   decltype(T::staticMethod(int)) ClassTemplate&lt;T&gt;::methodTemplate(int a) {
                                  ^
  a.cpp:10:36: error: candidate is: int ClassTemplate&lt;T&gt;::methodTemplate(int)
       decltype(T::staticMethod(int)) methodTemplate(int a);
                                      ^
  /tmp$ g++ -dumpversion
  4.8.3
  </code></pre>
  
  <p>Is what I want to do possible? If so, how?</p>