title: Visual C++ bug for aliasing templated struct variable in trailing return type (?)
body: <p>I have some code that compiles on Clang but is rejected by Visual C++. I managed to break it down to this sample:</p>
  <pre><code>template &lt;typename T&gt;
  static constexpr bool BoolValue = std::is_same_v&lt;T, int&gt;;
  
  template &lt;typename X&gt;
  struct Struct final
  {
      template &lt;typename T, typename U&gt;
      static constexpr bool BoolValue = std::is_same_v&lt;T, U&gt;;
  
      template &lt;typename Y&gt;
      auto method() -&gt; std::enable_if_t&lt;BoolValue&lt;X, Y&gt;&gt;;
  };
  
  template &lt;typename X&gt;
  template &lt;typename Y&gt;
  auto Struct&lt;X&gt;::method() -&gt; std::enable_if_t&lt;BoolValue&lt;X, Y&gt;&gt; {}
  </code></pre>
  <p>It seems that the trailing return type in the final line should be referencing <code>Struct::BoolValue</code>, <strong>not</strong> <code>::BoolValue</code>. It works on Clang, but is rejected by Visual C++ 2019 (latest version):</p>
  <pre><code>error C2977: 'BoolValue': too many template arguments
  message : see declaration of 'BoolValue'
  error C2993: 'unknown-type': is not a valid type for non-type template parameter '_Test'
  error C2976: 'std::enable_if_t': too few template arguments
  message : see declaration of 'std::enable_if_t'
  error C2244: 'Struct&lt;X&gt;::method': unable to match function definition to an existing declaration
  message : see declaration of 'Struct&lt;X&gt;::method'
  message : definition
  message : 'unknown-type Struct&lt;X&gt;::method(void)'
  message : existing declarations
  message : 'enable_if&lt;Struct&lt;X&gt;::BoolValue&lt;X,Y&gt;,void&gt;::type Struct&lt;X&gt;::method(void)'
  </code></pre>
  <p>I suspect this is a compiler bug, but I wanted to first check: is this code valid?</p>