[Bug c++/92423] Reference assigned from a ternary results in destructor call
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Nov 8 16:09:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92423
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |jakub at gcc dot gnu.org
Resolution|--- |DUPLICATE
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This used to be rejected before r260272 with:
pr92423.C: In function ‘int main()’:
pr92423.C:15:49: error: use of deleted function ‘Foo::Foo(const Foo&)’
const auto& my_foo = (true ? base_foo : throw "");
^~
pr92423.C:4:3: note: declared here
Foo (const Foo& x) = delete;
^~~
starting with that would call the dtor twice, and finally since r274550 aka
PR90393 calls dtor just once.
I think the g++.dg/expr/cond16.C testcase is sufficiently similar to this one
that it isn't worth adding another one.
*** This bug has been marked as a duplicate of bug 90393 ***
More information about the Gcc-bugs
mailing list