diff options
author | Patrick Palka <ppalka@redhat.com> | 2022-01-25 15:04:49 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2022-01-25 15:04:49 -0500 |
commit | bc90dd0ecf02e11d47d1af7f627e2e2acaa40106 (patch) | |
tree | 6c0327a58edac0215017c29454f4603a5cbbf1e9 /gcc/builtins.cc | |
parent | fe5cee6f62a0b229d9d51616b7490331d39b5ddd (diff) | |
download | gcc-bc90dd0ecf02e11d47d1af7f627e2e2acaa40106.zip gcc-bc90dd0ecf02e11d47d1af7f627e2e2acaa40106.tar.gz gcc-bc90dd0ecf02e11d47d1af7f627e2e2acaa40106.tar.bz2 |
c++: deleted fn and noexcept inst [PR101532, PR104225]
Here when attempting to use B's implicitly deleted default constructor,
mark_used rightfully returns false, but for the wrong reason: it
tries to instantiate the synthesized noexcept specifier which then only
silently fails because get_defaulted_eh_spec suppresses diagnostics
for deleted functions. This lack of diagnostics causes us to crash on
the first testcase below (thanks to the assert in finish_expr_stmt), and
silently accept the second testcase.
To fix this, this patch makes mark_used avoid attempting to instantiate
the noexcept specifier of a deleted function, so that we'll instead
directly reject (and diagnose) the function due to its deletedness.
PR c++/101532
PR c++/104225
gcc/cp/ChangeLog:
* decl2.cc (mark_used): Don't consider maybe_instantiate_noexcept
on a deleted function.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/nsdmi-template21.C: New test.
* g++.dg/cpp0x/nsdmi-template21a.C: New test.
Diffstat (limited to 'gcc/builtins.cc')
0 files changed, 0 insertions, 0 deletions