Commit a3d536f1 by Volker Reichelt Committed by Volker Reichelt

re PR c++/11468 (Deriving from CNI class java::lang::Object causing an ICE)

	PR c++/11468
	* init.c (build_new_1): Handle error_mark_nodes returned by
	build_java_class_ref.
	(build_java_class_ref): Do not abort compilation, but return
	error_mark_node.  Improve error message.  Fix indentation.

	* g++.dg/other/java2.C: New test.

From-SVN: r114937
parent 6de5f432
2006-06-23 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/11468
* init.c (build_new_1): Handle error_mark_nodes returned by
build_java_class_ref.
(build_java_class_ref): Do not abort compilation, but return
error_mark_node. Improve error message. Fix indentation.
2006-06-23 Danny Smith <dannysmith@users.sourceforge.net> 2006-06-23 Danny Smith <dannysmith@users.sourceforge.net>
PR target/27789 PR target/27789
......
...@@ -1696,6 +1696,9 @@ build_new_1 (tree placement, tree type, tree nelts, tree init, ...@@ -1696,6 +1696,9 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
tree class_decl = build_java_class_ref (elt_type); tree class_decl = build_java_class_ref (elt_type);
static const char alloc_name[] = "_Jv_AllocObject"; static const char alloc_name[] = "_Jv_AllocObject";
if (class_decl == error_mark_node)
return error_mark_node;
use_java_new = 1; use_java_new = 1;
if (!get_global_value_if_present (get_identifier (alloc_name), if (!get_global_value_if_present (get_identifier (alloc_name),
&alloc_fn)) &alloc_fn))
...@@ -2148,8 +2151,10 @@ build_java_class_ref (tree type) ...@@ -2148,8 +2151,10 @@ build_java_class_ref (tree type)
{ {
jclass_node = IDENTIFIER_GLOBAL_VALUE (get_identifier ("jclass")); jclass_node = IDENTIFIER_GLOBAL_VALUE (get_identifier ("jclass"));
if (jclass_node == NULL_TREE) if (jclass_node == NULL_TREE)
fatal_error ("call to Java constructor, while %<jclass%> undefined"); {
error ("call to Java constructor, while %<jclass%> undefined");
return error_mark_node;
}
jclass_node = TREE_TYPE (jclass_node); jclass_node = TREE_TYPE (jclass_node);
} }
...@@ -2164,7 +2169,10 @@ build_java_class_ref (tree type) ...@@ -2164,7 +2169,10 @@ build_java_class_ref (tree type)
break; break;
} }
if (!field) if (!field)
internal_error ("can't find class$"); {
error ("can't find %<class$%> in %qT", type);
return error_mark_node;
}
} }
class_decl = IDENTIFIER_GLOBAL_VALUE (name); class_decl = IDENTIFIER_GLOBAL_VALUE (name);
......
2006-06-23 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/11468
* g++.dg/other/java2.C: New test.
2006-06-23 Danny Smith <dannysmith@users.sourceforge.net> 2006-06-23 Danny Smith <dannysmith@users.sourceforge.net>
PR target/27789 PR target/27789
// PR c++/???
// { dg-do compile }
extern "Java"
{
struct A {};
}
typedef void* jclass;
A* p = new A; // { dg-error "class\\$" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment