diff options
author | Jason Merrill <jason@redhat.com> | 2021-01-13 13:27:53 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2021-01-15 13:57:01 -0500 |
commit | 424deca72b63e644cbc975cbc2fdda5248449bcb (patch) | |
tree | 89767d1681fe4b2357093bb87e013dbbaaf179ca /gcc/cp/cp-tree.h | |
parent | ad2603433853129e847cade5e269c6a5f889a020 (diff) | |
download | gcc-424deca72b63e644cbc975cbc2fdda5248449bcb.zip gcc-424deca72b63e644cbc975cbc2fdda5248449bcb.tar.gz gcc-424deca72b63e644cbc975cbc2fdda5248449bcb.tar.bz2 |
c++: Fix copy elision for base initialization
While working on PR98642 I noticed that in this testcase we were eliding the
copy, calling the complete default constructor to initialize the B base
subobject, and therefore wrongly initializing the non-existent A subobject
of B. The test doesn't care whether the copy is elided or not, but checks
that we are actually calling a base constructor for B.
The patch preserves the elision, but changes the initializer to call the
base constructor instead of the complete constructor.
gcc/cp/ChangeLog:
* call.c (base_ctor_for, make_base_init_ok): New.
(build_over_call): Use make_base_init_ok.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/elide4.C: New test.
Diffstat (limited to 'gcc/cp/cp-tree.h')
0 files changed, 0 insertions, 0 deletions