File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
components/eamxx/src/share Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ set_extra_data (const std::string& key,
34
34
35
35
std::shared_ptr<FieldHeader> FieldHeader::alias (const std::string& name) const {
36
36
auto fh = create_header (get_identifier ().alias (name));
37
+ if (get_parent () != nullptr ) {
38
+ // If we're aliasing, we MUST keep track of the parent
39
+ fh->create_parent_child_link (get_parent ());
40
+ }
37
41
fh->m_tracking = m_tracking;
38
42
fh->m_alloc_prop = m_alloc_prop;
39
43
fh->m_extra_data = m_extra_data;
Original file line number Diff line number Diff line change @@ -271,6 +271,10 @@ TEST_CASE("field", "") {
271
271
auto g1_x0 = f1.subfield (1 ,0 );
272
272
auto g1_x1 = f1.subfield (1 ,1 );
273
273
274
+ // Check we preserve parent info
275
+ auto f1_0x_p = f1_0x.get_header ().get_parent ();
276
+ REQUIRE (f1_0x.alias (" foo" ).get_header ().get_parent ()==f1_0x_p);
277
+
274
278
REQUIRE (f1_0x.is_aliasing (g1_0x));
275
279
REQUIRE (f1_1x.is_aliasing (g1_1x));
276
280
REQUIRE (f1_x0.is_aliasing (g1_x0));
You can’t perform that action at this time.
0 commit comments