* Trouble with typedefs in Barton-Nackman constructs.
@ 2002-12-10 5:22 A Gutkin
0 siblings, 0 replies; only message in thread
From: A Gutkin @ 2002-12-10 5:22 UTC (permalink / raw)
To: gcc
Hi,
I am having problem with typedefs in a C++ construct known as
Barton-Nackman trick. Trying to compile the following with gcc 3.2.1 (or
any other version up to 2.96):
template <typename T>
struct A {
typedef typename T::element_type element_type;
};
template <typename T>
struct B : public A<B<T> > {
typedef T element_type;
};
int main(void) {
B<float> test;
return 0;
}
gives the following errors:
test.cc: In instantiation of `A<B<float> >':
test.cc:15: instantiated from `B<float>'
test.cc:15: instantiated from here
test.cc:4: no type named `element_type' in `struct B<float>'
I wonder whether this is illegal according to C++ standard, or just a bug
in g++ ?
Any advice would be appreciated,
Alex.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-12-10 11:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-10 5:22 Trouble with typedefs in Barton-Nackman constructs A Gutkin
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).