diff options
author | Marek Polacek <polacek@redhat.com> | 2020-02-26 00:33:52 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2020-02-26 00:34:39 -0500 |
commit | f52ec6bc163af837cd13e234b7c2eab6bc456e12 (patch) | |
tree | db282ab49659b6119930d1b0c5094d142803621b /gcc/cp/ChangeLog | |
parent | 32988aac5be4fa472823e21d2d0eb877faca5667 (diff) | |
download | gcc-f52ec6bc163af837cd13e234b7c2eab6bc456e12.zip gcc-f52ec6bc163af837cd13e234b7c2eab6bc456e12.tar.gz gcc-f52ec6bc163af837cd13e234b7c2eab6bc456e12.tar.bz2 |
PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
After r269667 which introduced joust_maybe_elide_copy, in C++17 we can elide
a constructor if it uses a conversion function that returns a prvalue, and
use the conversion function in its stead.
This eliding means that if we have a candidate that previously didn't have
->second_conv, it can have it after the elision. This confused the
-Wconversion warning because it was assuming that if cand1->second_conv is
non-null, so is cand2->second_conv. Here cand1->second_conv was non-null
but cand2->second_conv remained null, so it crashed in compare_ics.
I checked with clang that both compilers call A::operator B() in C++17 and
B::B(A const &) otherwise.
gcc/cp/ChangeLog
2020-02-26 Marek Polacek <polacek@redhat.com>
PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
* call.c (joust): Don't attempt to warn if ->second_conv is null.
gcc/testsuite/ChangeLog
2020-02-26 Marek Polacek <polacek@redhat.com>
PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
* g++.dg/cpp0x/overload-conv-4.C: New test.
Diffstat (limited to 'gcc/cp/ChangeLog')
-rw-r--r-- | gcc/cp/ChangeLog | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 260f38f..1b5e2bb 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2020-02-26 Marek Polacek <polacek@redhat.com> + + PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion. + * call.c (joust): Don't attempt to warn if ->second_conv is null. + 2020-02-26 Jason Merrill <jason@redhat.com> PR c++/86521 - C++17 copy elision in initialization by constructor. |