Handle new'ing of Java classes.
* init.c (build_class_classref): New function.
(build_new_1): If type is TYPE_FOR_JAVA: Call _Jv_AllocObject;
constructor does not return this; don't need to exception-protect.
* pt.c (lookup_template_class): Copy TYPE_FOR_JAVA flag.
* decl2.c (acceptable_java_type): Handle template-derived types.
From-SVN: r21881
type = TREE_TYPE (type);
if (TREE_CODE (type) == RECORD_TYPE)
{
- complete_type (type);
- return TYPE_FOR_JAVA (type);
+ tree args; int i;
+ if (! TYPE_FOR_JAVA (type))
+ return 0;
+ if (! CLASSTYPE_TEMPLATE_INFO (type))
+ return 1;
+ args = CLASSTYPE_TI_ARGS (type);
+ i = TREE_VEC_LENGTH (args);
+ while (--i >= 0)
+ {
+ type = TREE_VEC_ELT (args, i);
+ if (TREE_CODE (type) == POINTER_TYPE)
+ type = TREE_TYPE (type);
+ if (! TYPE_FOR_JAVA (type))
+ return 0;
+ }
+ return 1;
}
}
return 0;