title: Inheritance with templates shadows inherited member
body: <p>I'm having the weirdest error and I've no idea what I'm doing wrong.</p>
  
  <pre><code>template &lt;bool X&gt;
  struct A {
      int x;
  };
  
  template &lt;bool X&gt;
  struct B : public A&lt;X&gt; {
      B() { x = 3; } // Error: 'x' was not declared in this scope.
  };
  </code></pre>
  
  <p>I don't understand how it's possible that I cannot see <code>x</code> from <code>B</code>, given that I'm inheriting <code>A</code> publicly.</p>
  
  <p>At the same time, this code compiles:</p>
  
  <pre><code>template &lt;bool X&gt;
  struct A {
      int x;
  };
  
  template &lt;bool X&gt;
  struct B : public A&lt;X&gt; {};
  
  int main() {
      B&lt;false&gt; b;
      b.x = 4;
  };
  </code></pre>
  
  <p>I'm compiling with g++ 7.0.1.</p>
  
  <p>Edit: It seems that if I reference the full-name of <code>x</code>, the code compiles, as in:</p>
  
  <pre><code>B() { A&lt;X&gt;::x = 3; }
  </code></pre>
  
  <p>But why?</p>