Skip to content
Snippets Groups Projects
Commit 424deca7 authored by Jason Merrill's avatar Jason Merrill
Browse files

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.
parent ad260343
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment