Topic: default template args in a typedef
Author: tim@franck.Princeton.EDU (Tim Hollebeek)
Date: 1996/02/19 Raw View
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. ]
Author: jason@cygnus.com (Jason Merrill)
Date: 1996/02/20 Raw View
>>>>> 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
]