tbaeder added inline comments.
================
Comment at: clang/test/AST/Interp/records.cpp:208
+
+struct S {
+ int a = 0;
----------------
aaron.ballman wrote:
> Hmmm, this feels related to the discarded value results changes, but it might
> be a test case for a different scenario as well, so take this or leave it:
> ```
> struct S {
> int &Ref;
> constexpr S(int &R) : Ref(R) { Ref = 0; }
> constexpr ~S() { Ref = 12; }
> };
>
> constexpr S get_s(int &i) { return S{i}; }
>
> constexpr int func() {
> int i = 1;
> {
> get_s(i);
> }
> return i;
> }
>
> static_assert(func() == 12);
> ```
> The idea behind the test is -- we construct the `S` object but discard its
> results in the compound block, but the dtor still runs as expected.
I think this would trigger the TODO I added, since this is a RVO function but
we have nowhere to write the return value.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136013/new/
https://reviews.llvm.org/D136013
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits