Commit 4b5aa881 by Jason Merrill Committed by Jason Merrill

re PR c++/12726 (ICE (segfault) on trivial code)

        PR c++/12726
        * tree.c (build_target_expr_with_type): Don't call force_rvalue
        for CONSTRUCTORs.

From-SVN: r72837
parent 941ba69d
2003-10-23 Jason Merrill <jason@redhat.com>
PR c++/12726
* tree.c (build_target_expr_with_type): Don't call force_rvalue
for CONSTRUCTORs.
2003-10-22 Kazu Hirata <kazu@cs.umass.edu>
* call.c: Fix comment formatting.
......
......@@ -311,10 +311,12 @@ build_target_expr_with_type (tree init, tree type)
if (TREE_CODE (init) == TARGET_EXPR)
return init;
else if (CLASS_TYPE_P (type) && !TYPE_HAS_TRIVIAL_INIT_REF (type)
&& TREE_CODE (init) != COND_EXPR)
&& TREE_CODE (init) != COND_EXPR
&& TREE_CODE (init) != CONSTRUCTOR)
/* We need to build up a copy constructor call. COND_EXPR is a special
case because we already have copies on the arms and we don't want
another one here. */
another one here. A CONSTRUCTOR is aggregate initialization, which
is handled separately. */
return force_rvalue (init);
slot = build_decl (VAR_DECL, NULL_TREE, type);
......
// PR c++/12726
// { dg-options "" }
#include <string>
struct foobar {
std::string s;
};
int main(int argc, char **argv)
{
foobar fb;
fb = (foobar) { "abcd" };
return 0;
}
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