You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer (#87933)
This PR complete [DR1815](https://wg21.link/CWG1815) under the guidance
of `FIXME` comments. And reuse `CXXDefaultInitExpr` rewrite machinery to
clone the initializer expression on each use that would lifetime extend
its temporaries.
---------
Signed-off-by: yronglin <[email protected]>
// since-cxx14-warning@-1 {{lifetime extension of temporary created by aggregate initialization using a default member initializer is not yet supported; lifetime of temporary will end at the end of the full-expression}}
487
-
// since-cxx14-note@#cwg1696-D1-a {{initializing field 'a' with default member initializer}}
// since-cxx14-warning@-1 {{lifetime extension of temporary created by aggregate initialization using a default member initializer is not yet supported; lifetime of temporary will end at the end of the full-expression}} FIXME
215
-
// since-cxx14-note@#cwg1815-A {{initializing field 'r' with default member initializer}}
216
213
217
214
structB { int &&r = 0; }; // #cwg1815-B
218
215
// since-cxx14-error@-1 {{reference member 'r' binds to a temporary object whose lifetime would be shorter than the lifetime of the constructed object}}
219
216
// since-cxx14-note@#cwg1815-B {{initializing field 'r' with default member initializer}}
220
217
// since-cxx14-note@#cwg1815-b {{in implicit default constructor for 'cwg1815::B' first required here}}
Copy file name to clipboardExpand all lines: clang/test/SemaCXX/constexpr-default-arg.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -32,8 +32,8 @@ void test_default_arg2() {
32
32
}
33
33
34
34
// Check that multiple CXXDefaultInitExprs don't cause an assertion failure.
35
-
structA { int &&r = 0; };// expected-note 2{{default member initializer}}
35
+
structA { int &&r = 0; };
36
36
structB { A x, y; };
37
-
B b = {}; // expected-warning 2{{lifetime extension of temporary created by aggregate initialization using a default member initializer is not yet supported}}
0 commit comments