PR c++/78495 - wrong code inherited ctor and invisi-ref parm
PR c++/78495 - wrong code inherited ctor and invisi-ref parm * cp-gimplify.c (cp_generize_r): Don't skip thunks. PR c++/79495 * g++.dg/cpp1z/inh-ctor38.C: New. From-SVN: r244728
This commit is contained in:
parent
f14d2c52d4
commit
4b9f211511
|
@ -1,3 +1,8 @@
|
|||
2017-01-20 Nathan Sidwell <nathan@acm.org>
|
||||
|
||||
PR c++/78495 - wrong code inherited ctor and invisi-ref parm
|
||||
* cp-gimplify.c (cp_generize_r): Don't skip thunks.
|
||||
|
||||
2017-01-20 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
PR c++/77829
|
||||
|
|
|
@ -1103,15 +1103,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
|
|||
&& omp_var_to_track (stmt))
|
||||
omp_cxx_notice_variable (wtd->omp_ctx, stmt);
|
||||
|
||||
/* Don't dereference parms in a thunk, pass the references through. */
|
||||
if ((TREE_CODE (stmt) == CALL_EXPR && CALL_FROM_THUNK_P (stmt))
|
||||
|| (TREE_CODE (stmt) == AGGR_INIT_EXPR && AGGR_INIT_FROM_THUNK_P (stmt)))
|
||||
{
|
||||
*walk_subtrees = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Otherwise, do dereference invisible reference parms. */
|
||||
/* Dereference invisible reference parms. */
|
||||
if (wtd->handle_invisiref_parm_p && is_invisiref_parm (stmt))
|
||||
{
|
||||
*stmt_p = convert_from_reference (stmt);
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2017-01-20 Nathan Sidwell <nathan@acm.org>
|
||||
|
||||
PR c++/79495
|
||||
* g++.dg/cpp1z/inh-ctor38.C: New.
|
||||
|
||||
2017-01-20 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c/79152
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
// { dg-do run { target c++11 } }
|
||||
// PR78495 failed to propagate pass-by-value struct to base ctor.
|
||||
|
||||
struct Ptr {
|
||||
void *ptr = 0;
|
||||
|
||||
Ptr() {}
|
||||
Ptr(Ptr const&) = delete;
|
||||
Ptr(Ptr&& other) : ptr (other.ptr) {}
|
||||
};
|
||||
|
||||
struct Base {
|
||||
Ptr val;
|
||||
Base(Ptr val_) : val(static_cast<Ptr&&>(val_)) {}
|
||||
};
|
||||
|
||||
struct Derived: Base {
|
||||
using Base::Base;
|
||||
};
|
||||
|
||||
void *Foo () {
|
||||
Ptr ptr;
|
||||
|
||||
Derived d(static_cast<Ptr&&>(ptr));
|
||||
|
||||
return d.val.ptr;
|
||||
}
|
||||
|
||||
int main () {
|
||||
return Foo () != 0;
|
||||
}
|
Loading…
Reference in New Issue