aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2001-07-25 09:38:26 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2001-07-25 09:38:26 +0000
commit402604293366e07b85db805930f1bcf1f0bac947 (patch)
treed493c5f26270f94be4e2797ecc940088fefb192c /gcc/cp
parentab085207aad52d58945ea30b78c04e050d7b5a9a (diff)
downloadgcc-402604293366e07b85db805930f1bcf1f0bac947.zip
gcc-402604293366e07b85db805930f1bcf1f0bac947.tar.gz
gcc-402604293366e07b85db805930f1bcf1f0bac947.tar.bz2
re PR c++/3416 (gcc-3.0 Internal compiler error in arg_assoc, at cp/decl2.c:4902)
cp: PR c++/3416 * call.c (build_conditional_expr): Recheck args after conversions. * cp-tree.h (build_conditional_expr): Move to correct file. * typeck.c (decay_conversion): Diagnose any unknown types reaching here. (build_binary_op): Don't do initial decay or default conversions on overloaded functions. (build_static_cast): Don't do a decay conversion here. testsuite: * g++.old-deja/g++.other/cond7.C: New test. From-SVN: r44345
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog12
-rw-r--r--gcc/cp/call.c3
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/typeck.c22
4 files changed, 33 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9d1844d..eb00008 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,17 @@
2001-07-25 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/3416
+ * call.c (build_conditional_expr): Recheck args after
+ conversions.
+ * cp-tree.h (build_conditional_expr): Move to correct file.
+ * typeck.c (decay_conversion): Diagnose any unknown types
+ reaching here.
+ (build_binary_op): Don't do initial decay or default
+ conversions on overloaded functions.
+ (build_static_cast): Don't do a decay conversion here.
+
+2001-07-25 Nathan Sidwell <nathan@codesourcery.com>
+
PR c++/3543
* typeck.c (condition_conversion): Resolve an OFFSET_REF.
* expr.c (cplus_expand_expr): An OFFSET_REF should never get here.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index c8c5246..4be0920 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -3092,6 +3092,9 @@ build_conditional_expr (arg1, arg2, arg3)
arg3 = decay_conversion (arg3);
arg3_type = TREE_TYPE (arg3);
+ if (arg2 == error_mark_node || arg3 == error_mark_node)
+ return error_mark_node;
+
/* [expr.cond]
After those conversions, one of the following shall hold:
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 4809aca..8a6b0ae 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -3545,6 +3545,7 @@ extern int get_arglist_len_in_bytes PARAMS ((tree));
extern tree build_vfield_ref PARAMS ((tree, tree));
extern tree build_scoped_method_call PARAMS ((tree, tree, tree, tree));
+extern tree build_conditional_expr PARAMS ((tree, tree, tree));
extern tree build_addr_func PARAMS ((tree));
extern tree build_call PARAMS ((tree, tree));
extern tree build_method_call PARAMS ((tree, tree, tree, tree, int));
@@ -4305,7 +4306,6 @@ extern tree build_x_binary_op PARAMS ((enum tree_code, tree, tree));
extern tree build_x_unary_op PARAMS ((enum tree_code, tree));
extern tree unary_complex_lvalue PARAMS ((enum tree_code, tree));
extern tree build_x_conditional_expr PARAMS ((tree, tree, tree));
-extern tree build_conditional_expr PARAMS ((tree, tree, tree));
extern tree build_x_compound_expr PARAMS ((tree));
extern tree build_compound_expr PARAMS ((tree));
extern tree build_static_cast PARAMS ((tree, tree));
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index a6ddcf2..9043111 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1729,6 +1729,12 @@ decay_conversion (exp)
if (type == error_mark_node)
return error_mark_node;
+ if (type_unknown_p (exp))
+ {
+ incomplete_type_error (exp, TREE_TYPE (exp));
+ return error_mark_node;
+ }
+
/* Constants can be used directly unless they're not loadable. */
if (TREE_CODE (exp) == CONST_DECL)
exp = DECL_INITIAL (exp);
@@ -3365,17 +3371,24 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
int common = 0;
/* Apply default conversions. */
+ op0 = orig_op0;
+ op1 = orig_op1;
+
if (code == TRUTH_AND_EXPR || code == TRUTH_ANDIF_EXPR
|| code == TRUTH_OR_EXPR || code == TRUTH_ORIF_EXPR
|| code == TRUTH_XOR_EXPR)
{
- op0 = decay_conversion (orig_op0);
- op1 = decay_conversion (orig_op1);
+ if (!really_overloaded_fn (op0))
+ op0 = decay_conversion (op0);
+ if (!really_overloaded_fn (op1))
+ op1 = decay_conversion (op1);
}
else
{
- op0 = default_conversion (orig_op0);
- op1 = default_conversion (orig_op1);
+ if (!really_overloaded_fn (op0))
+ op0 = default_conversion (op0);
+ if (!really_overloaded_fn (op1))
+ op1 = default_conversion (op1);
}
/* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */
@@ -5100,7 +5113,6 @@ build_static_cast (type, expr)
build_tree_list (NULL_TREE, expr),
TYPE_BINFO (type), LOOKUP_NORMAL)));
- expr = decay_conversion (expr);
intype = TREE_TYPE (expr);
/* FIXME handle casting to array type. */