From: Per Bothner Date: Thu, 20 Aug 1998 16:44:01 +0000 (-0700) Subject: Handle new'ing of Java classes. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=824f42abafb7f57ac2c25f329640b58eacbd7370;p=gcc.git Handle new'ing of Java classes. 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 --- diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index c0b12e50304..8e1d0c791ed 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1403,8 +1403,22 @@ acceptable_java_type (type) 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;