[G++] templates not instantiated early enough
Andrew Pinski
pinskia@physics.uc.edu
Fri Jun 4 02:58:00 GMT 2004
On Jun 3, 2004, at 22:33, Chris Lattner wrote:
> The problem is that, in this testcase (which is reduced from a
> non-pointless larger testcase), the some_template is never instantiated
> with an int type. This causes problems for my backend, which needs to
> look at the types for arguments for foo. Currently, since the
> template is
> never being instantiated, the TYPE_SIZE and other fields are null. The
> target that I'm working on specifically needs types laid out for
> function
> prototypes that take an aggregate value by value (as in this case).
> Pointers to templates can be lazily instantiated as needed.
Why does it need them? You should only need them for prototypes
which are used.
If you question is rather is the following valid code:
template<typename Ty>
struct some_template {typename Ty::t t;};
void foo(some_template<int> a);
void (*f) (some_template<int>) = foo;
As this case is where the template refers to an invalid type, int::t.
Thanks,
Andrew Pinski
More information about the Gcc
mailing list