diff options
author | Giovanni Bajo <giovannibajo@gcc.gnu.org> | 2003-12-07 15:23:31 +0000 |
---|---|---|
committer | Giovanni Bajo <giovannibajo@gcc.gnu.org> | 2003-12-07 15:23:31 +0000 |
commit | 9f6a794d626563787e7ed032ae56c005c2a50d6c (patch) | |
tree | cceed65ec08f95207104d09da9520944043f5c66 /gcc/cp/init.c | |
parent | 1f866b457dcc4257bb7c79b0eae9403faf9a33ff (diff) | |
download | gcc-9f6a794d626563787e7ed032ae56c005c2a50d6c.zip gcc-9f6a794d626563787e7ed032ae56c005c2a50d6c.tar.gz gcc-9f6a794d626563787e7ed032ae56c005c2a50d6c.tar.bz2 |
re PR c++/2294 (using declaration confusion)
PR c++/2294
* name-lookup.c (push_overloaded_decl): Always construct an
OVERLOAD unless the declaration is a built-in.
(set_namespace_binding): While binding OVERLOADs with only one
declaration, we still need to call supplement_binding.
* init.c (build_new_1): Deal with an OVERLOAD set when
looking up for _Jv_AllocObject.
* except.c (build_throw): Likewise for _Jv_Throw.
From-SVN: r74394
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r-- | gcc/cp/init.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 332c518..19642d6 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2005,11 +2005,18 @@ build_new_1 (tree exp) tree class_size = size_in_bytes (true_type); static const char alloc_name[] = "_Jv_AllocObject"; use_java_new = 1; - alloc_decl = IDENTIFIER_GLOBAL_VALUE (get_identifier (alloc_name)); - if (alloc_decl == NULL_TREE) - fatal_error ("call to Java constructor with `%s' undefined", - alloc_name); - + if (!get_global_value_if_present (get_identifier (alloc_name), + &alloc_decl)) + {
+ error ("call to Java constructor with `%s' undefined", alloc_name); + return error_mark_node; + } + else if (really_overloaded_fn (alloc_decl)) + {
+ error ("`%D' should never be overloaded", alloc_decl); + return error_mark_node; + } + alloc_decl = OVL_CURRENT (alloc_decl); class_addr = build1 (ADDR_EXPR, jclass_node, class_decl); alloc_call = (build_function_call (alloc_decl, |