public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* GCC 3.4.0: a derived class can't access the data member of a template base class
@ 2004-06-21 9:10 Frank Chow
2004-06-21 16:50 ` Alexandre Oliva
0 siblings, 1 reply; 2+ messages in thread
From: Frank Chow @ 2004-06-21 9:10 UTC (permalink / raw)
To: gcc-bugs
Windows 2000 sp4
gcc (GCC) 3.4.0 (mingw special)
The following code can not be compiled by gcc (GCC) 3.4.0 (mingw special)
// try.cpp
#include <iostream>
struct B
{
size_t nSize;
};
template <typename T>
struct D : public T
{
D()
{
nSize = sizeof(T);
}
};
using namespace std;
int main()
{
D<B> sth;
cout << sth.nSize << endl;
return 0;
}
(compile instruction)
H:\current2>g++ -o try try.cpp
(output)
try.cpp: In constructor `D<T>::D()':
try.cpp:13: error: `nSize' undeclared (first use this function)
try.cpp:13: error: (Each undeclared identifier is reported only once for each fu
nction it appears in.)
By the way, gcc (GCC) 3.3.1 (cygwin version) can compile this code successfully, so do Visual C++ .Net (cl v 13.10.3077).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-06-21 16:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-21 9:10 GCC 3.4.0: a derived class can't access the data member of a template base class Frank Chow
2004-06-21 16:50 ` Alexandre Oliva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).