This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [G++] templates not instantiated early enough



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]