aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2006-05-19 03:01:14 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2006-05-19 03:01:14 +0000
commit41990f964687332cd2ea2ad59a02c18ed499db6c (patch)
treee4b7d562777fd7a64677150037b1ea3eaa0694ff /gcc/cp/init.c
parent84e2e37098ecd0a1085501dade4348e33fe5a695 (diff)
downloadgcc-41990f964687332cd2ea2ad59a02c18ed499db6c.zip
gcc-41990f964687332cd2ea2ad59a02c18ed499db6c.tar.gz
gcc-41990f964687332cd2ea2ad59a02c18ed499db6c.tar.bz2
re PR c++/27471 (ICE within build_c_cast cp/typeck.c:5434)
PR c++/27471 PR c++/27506 * typeck.c (decay_conversion): Convert bitfields to their declared types here. Improve documentation. Avoid use of cp_convert. (default_conversion): Make it static. Perform integral promotions before lvalue-to-rvalue, function-to-pointer, and array-to-pointer conversions. * init.c (build_init): Remove. (expand_default_init): Do not call rvalue. * call.c (null_ptr_cst_p): Robustify. (build_conditional_expr): Tidy. * except.c (build_throw): Do not perform lvalue-to-rvalue conversion on operand before initializing temporary. * tree.c (convert.h): Include it. (convert_bitfield_to_declared_type): Use convert_to_integer, not cp_convert. (rvalue): Don't convert bitfields to their declared type here. * cp-tree.h (build_init): Remove. (default_conversion): Likewise. * typeck2.c (build_m_component_ref): Do not perform lvalue-to-rvalue, function-to-pointer, or array-to-pointer conversions here. Correct error message. PR c++/27471 PR c++/27506 * g++.dg/conversion/bitfield5.C: New test. * g++.dg/conversion/bitfield6.C: New test. From-SVN: r113902
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index bc6df20..e9528f2 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1142,26 +1142,6 @@ build_aggr_init (tree exp, tree init, int flags)
return stmt_expr;
}
-/* Like build_aggr_init, but not just for aggregates. */
-
-tree
-build_init (tree decl, tree init, int flags)
-{
- tree expr;
-
- if (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
- expr = build_aggr_init (decl, init, flags);
- else if (CLASS_TYPE_P (TREE_TYPE (decl)))
- expr = build_special_member_call (decl, complete_ctor_identifier,
- build_tree_list (NULL_TREE, init),
- TREE_TYPE (decl),
- LOOKUP_NORMAL|flags);
- else
- expr = build2 (INIT_EXPR, TREE_TYPE (decl), decl, init);
-
- return expr;
-}
-
static void
expand_default_init (tree binfo, tree true_exp, tree exp, tree init, int flags)
{
@@ -2057,7 +2037,7 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
rval = build_nop (pointer_type, rval);
/* A new-expression is never an lvalue. */
- rval = rvalue (rval);
+ gcc_assert (!lvalue_p (rval));
return rval;
}