Thread View: comp.std.c++
2 messages
2 total messages
Started by Tim Hollebeek
Mon, 19 Feb 1996 02:23
default template args in a typedef
Author: Tim Hollebeek
Date: Mon, 19 Feb 1996 02:23
Date: Mon, 19 Feb 1996 02:23
35 lines
1471 bytes
1471 bytes
Is this legal?
-------
template <class T>
class X {
};
template <class T, class U = X<T> >
class Y {
};
typedef Y<double, X<double> > Z1;
typedef Y<double> Z2;
int main() {
Z1 z1;
Z2 z2; // <--- here
}
-------
g++ 2.7.2 doesn't mind Z1, but gives:
aggregate `Y<...> z2' has incomplete type and cannot be initialized
on the Z2 line.
---------------------------------------------------------------------------
Tim Hollebeek | Disclaimer :=> Everything above is a true statement,
<space for rent> | for sufficiently false values of true.
Princeton Univ. | email: tim@wfn-shop.princeton.edu
-------------------| http://wfn-shop.princeton.edu/~tim (NEW! IMPROVED!)
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. Moderation policy:
http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
Re: default template args in a typedef
Author: Jason Merrill
Date: Tue, 20 Feb 1996 18:56
Date: Tue, 20 Feb 1996 18:56
37 lines
1606 bytes
1606 bytes
>>>>> Tim Hollebeek <tim@franck.Princeton.EDU> writes:
> Is this legal?
> -------
> template <class T>
> class X {
> };
> template <class T, class U = X<T> >
> class Y {
> };
> typedef Y<double, X<double> > Z1;
> typedef Y<double> Z2;
> int main() {
> Z1 z1;
> Z2 z2; // <--- here
> }
> -------
> g++ 2.7.2 doesn't mind Z1, but gives:
> aggregate `Y<...> z2' has incomplete type and cannot be initialized
> on the Z2 line.
This is a bug in g++ 2.7.2.
Jason
---
[ To submit articles: Try just posting with your newsreader. If that fails,
use mailto:std-c++@ncar.ucar.edu
FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
Comments? mailto:std.c++-request@ncar.ucar.edu
]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads