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/class.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/class.c')
-rw-r--r-- | gcc/cp/class.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index c96f7bf..79686a2 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -318,6 +318,19 @@ build_base_path (enum tree_code code, return expr; } + /* If we're in an NSDMI, we don't have the full constructor context yet + that we need for converting to a virtual base, so just build a stub + CONVERT_EXPR and expand it later in bot_replace. */ + if (virtual_access && fixed_type_p < 0 + && current_scope () != current_function_decl) + { + expr = build1 (CONVERT_EXPR, ptr_target_type, expr); + CONVERT_EXPR_VBASE_PATH (expr) = true; + if (!want_pointer) + expr = build_indirect_ref (EXPR_LOCATION (expr), expr, RO_NULL); + return expr; + } + /* Do we need to check for a null pointer? */ if (want_pointer && !nonnull) { |