title: error determining a generic return type in C++11
body: <p>In the context of a C++14 application, I use a scheme which could be resumed as follows (minimal reproducible test):</p>
  
  <pre><code>template &lt;class Container&gt;
  struct LocateFunctions {    
    auto get_it() const // &lt;-- here is the problem
    {
      auto ret = typename Container::Iterator();
      return ret;
    }
  };
  
  template &lt;typename T&gt;
  struct A : public LocateFunctions&lt;A&lt;T&gt;&gt; {    
    struct Iterator {};
  };
  
  int main() {  
    A&lt;int&gt; a;
  }
  </code></pre>
  
  <p>This approach compiles and runs perfectly in C++14, with GCC and Clang compilers. </p>
  
  <p>Now I want migrate my application to Windows and for that I'm using MinGW. Unfortunately, its latest version brings GCC 4.9 which does not compile C++14. That does not seem like a serious problem because I can rewrite the C++14 constructs in C++11. So, I rewrite the <code>get_it()</code> method as follows:</p>
  
  <pre><code>typename Container::Iterator get_it() const
  { 
    auto ret = typename Container::Iterator();
    return ret;
  }
  </code></pre>
  
  <p>Unfortunately it does no compile. Both compilers produce the following error:</p>
  
  <pre><code>error: no type named ‘Iterator’ in ‘struct A&lt;int&gt;’
     typename Container::Iterator get_it() const
                              ^
  </code></pre>
  
  <p>I also tried:</p>
  
  <pre><code>auto get_it() const -&gt; decltype(typename Container::Iterator())
  { 
    auto ret = typename Container::Iterator();
    return ret;
  }
  </code></pre>
  
  <p>but I get exactly the same error.</p>
  
  <p>Since two compilers fail to recognize the type of return, I suppose it is impossible to determine it. But I do not really know why.</p>
  
  <p>Could someone please explain me why not compile and eventually a way for refactoring in C++11 that compiles?</p>