This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [G++] templates not instantiated early enough
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: Chris Lattner <sabre at nondot dot org>
- Cc: gcc at gcc dot gnu dot org, Andrew Pinski <pinskia at physics dot uc dot edu>
- Date: Thu, 3 Jun 2004 22:58:01 -0400
- Subject: Re: [G++] templates not instantiated early enough
- References: <Pine.LNX.4.44.0406032109340.27521-100000@nondot.org>
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