aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2021-03-04 14:25:01 -0500
committerMarek Polacek <polacek@redhat.com>2021-03-05 18:00:02 -0500
commit02a3554879001e8f1405d17e096ed68fc3f76975 (patch)
tree15d3d2b3ec01576d67f0731aa4cad0024211b245 /gcc/ada
parentc2e64c33d9d903f0a52565ad98300feea0ffc580 (diff)
downloadgcc-02a3554879001e8f1405d17e096ed68fc3f76975.zip
gcc-02a3554879001e8f1405d17e096ed68fc3f76975.tar.gz
gcc-02a3554879001e8f1405d17e096ed68fc3f76975.tar.bz2
c++: Pointer-to-member fn conversion with noexcept [PR99374]
The issue in this PR is that we wrongly reject converting pointers to member function of incomplete types, one of which has noexcept. Recall that pointers (including pointers to member functions) to non-throwing functions can be implicitly converted to potentially-throwing functions (but not vice versa). We reject the conversion when called from can_convert_arg_bad because standard_conversion can't create such a conversion. It comes down to the DERIVED_FROM_P check in the TYPE_PTRMEMFUNC_P block. It considers every class derived from itself, but not when the class is incomplete. But surely we want to reach fnptr_conv_p when tbase is fbase (one of them could be an alias to the other so use same_type_p instead of ==). Another approach would be to not perform DERIVED_FROM_P at all when either tbase or fbase are incomplete (so perhaps something like at the end of ptr_reasonably_similar). gcc/cp/ChangeLog: PR c++/99374 * call.c (standard_conversion): When converting pointers to member, don't return NULL when the bases are equivalent but incomplete. gcc/testsuite/ChangeLog: PR c++/99374 * g++.dg/cpp1z/noexcept-type23.C: New test.
Diffstat (limited to 'gcc/ada')
0 files changed, 0 insertions, 0 deletions