<p>The following code doesn't compile with gcc, but does with Visual Studio:</p>
<pre><code>template &lt;typename T&gt; class A {
public:
    T foo;
};

template &lt;typename T&gt; class B: public A &lt;T&gt; {
public:
    void bar() { cout &lt;&lt; foo &lt;&lt; endl; }
};
</code></pre>
<p>I get the error:</p>
<blockquote>
<p>test.cpp: In member function ‘void B::bar()’:</p>
<p>test.cpp:11: error: ‘foo’ was not declared in this scope</p>
</blockquote>
<p>But it should be! If I change <code>bar</code> to</p>
<pre><code>void bar() { cout &lt;&lt; this-&gt;foo &lt;&lt; endl; }
</code></pre>
<p>then it <em>does</em> compile, but I don't think I have to do this. Is there something in the official specs of C++ that GCC is following here, or is it just a quirk?</p>

This changed in
gcc-3.4
.  The C++ parser got much more strict in that release -- per the spec but still kinda annoying for people with legacy or multi-platform code bases.