diff options
author | Jason Merrill <jason@redhat.com> | 2011-12-21 14:19:47 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-12-21 14:19:47 -0500 |
commit | c65b06073ce31831f65fce84a393c106c1ad5a07 (patch) | |
tree | f9cb257f4823f2b31482274185ea050dec8ef4e9 /gcc/cp/tree.c | |
parent | e2c4d88e42f75633a0c55de1400dbee322438d70 (diff) | |
download | gcc-c65b06073ce31831f65fce84a393c106c1ad5a07.zip gcc-c65b06073ce31831f65fce84a393c106c1ad5a07.tar.gz gcc-c65b06073ce31831f65fce84a393c106c1ad5a07.tar.bz2 |
re PR c++/51611 ([c++0x] ICE with non-static data member initializer and virtual base class)
PR c++/51611
* cp-tree.h (CONVERT_EXPR_VBASE_PATH): New.
* class.c (build_base_path): Defer vbase conversion in an NSDMI.
* tree.c (bot_replace): Expand it here.
* cp-gimplify.c (cp_genericize_r): Make sure deferred conversion
doesn't leak into GENERIC.
From-SVN: r182602
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r-- | gcc/cp/tree.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index aabe863..634c267 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1944,6 +1944,20 @@ bot_replace (tree* t, parsing with the real one for this function. */ *t = current_class_ptr; } + else if (TREE_CODE (*t) == CONVERT_EXPR + && CONVERT_EXPR_VBASE_PATH (*t)) + { + /* In an NSDMI build_base_path defers building conversions to virtual + bases, and we handle it here. */ + tree basetype = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (*t))); + VEC(tree,gc) *vbases = CLASSTYPE_VBASECLASSES (current_class_type); + int i; tree binfo; + FOR_EACH_VEC_ELT (tree, vbases, i, binfo) + if (BINFO_TYPE (binfo) == basetype) + break; + *t = build_base_path (PLUS_EXPR, TREE_OPERAND (*t, 0), binfo, true, + tf_warning_or_error); + } return NULL_TREE; } |