diff options
author | Marek Polacek <polacek@redhat.com> | 2021-01-08 15:48:41 -0500 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2021-01-19 15:38:12 -0500 |
commit | c37f1d4081f5a19e39192d13e2a3acea13662e5a (patch) | |
tree | 2b54eeb11741ed9b45176013a08267250ec546b6 /gcc/go | |
parent | 7266ff2a243715e20882850b2fc4211ac7db4d34 (diff) | |
download | gcc-c37f1d4081f5a19e39192d13e2a3acea13662e5a.zip gcc-c37f1d4081f5a19e39192d13e2a3acea13662e5a.tar.gz gcc-c37f1d4081f5a19e39192d13e2a3acea13662e5a.tar.bz2 |
c++: ICE when late parsing noexcept/NSDMI [PR98333]
Since certain members of a class are a complete-class context
[class.mem.general]p7, we delay their parsing untile the whole class has
been parsed. For instance, NSDMIs and noexcept-specifiers. The order
in which we perform this delayed parsing matters; we were first parsing
NSDMIs and only they did we parse noexcept-specifiers. That turns out
to be wrong: since NSDMIs may use noexcept-specifiers, we must process
noexcept-specifiers first. Otherwise we'll ICE in code that doesn't
expect to see DEFERRED_PARSE.
This doesn't just shift the problem, noexcept-specifiers can use members
with a NSDMI just fine, and I've also tested a similar test with this
member function:
bool f() { return __has_nothrow_constructor (S<true>); }
and that compiled fine too.
gcc/cp/ChangeLog:
PR c++/98333
* parser.c (cp_parser_class_specifier_1): Perform late-parsing
of NSDMIs before late-parsing of noexcept-specifiers.
gcc/testsuite/ChangeLog:
PR c++/98333
* g++.dg/cpp0x/noexcept62.C: New test.
Diffstat (limited to 'gcc/go')
0 files changed, 0 insertions, 0 deletions