c++ template bug

root root@ptpp09.phy.tu-dresden.de
Tue Jul 28 06:45:00 GMT 1998


The following code compiles fine under g++ 2.8.1 and egcs-1.0.2, but not under the current egcs.

$ cat h.cc
template<class T>
class A {
public:
        void f();
};

class B : public A<int> {
public:
        void f();
};

int main()
{
   B b;
   B& b1 = b;
   b1.A<int>::f();
}

$ g++ -v
Reading specs from /opt/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.52/specs
gcc version egcs-2.91.52 19980728 (gcc2 ss-980609 experimental)
$ g++ h.cc
h.cc: In function `int main()':
h.cc:16: warning: invalid use of type decl `class A<int>' as expression
h.cc:16: parse error before `>'
$

--
Thomas Kunert



More information about the Gcc-bugs mailing list