diff options
author | Marek Polacek <polacek@redhat.com> | 2021-04-08 14:39:28 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2021-04-09 10:23:30 -0400 |
commit | 625dadaf5df5a2ae0d8c5660fd1eec8ba354479c (patch) | |
tree | d2241dd0b717ec3196f7b3f1c239342ffbd64a08 /libgomp/testsuite/libgomp.oacc-c-c++-common/static-variable-1.c | |
parent | 2dd7c570e67ce47702db4c5f776f02e0b35d7dd4 (diff) | |
download | gcc-625dadaf5df5a2ae0d8c5660fd1eec8ba354479c.zip gcc-625dadaf5df5a2ae0d8c5660fd1eec8ba354479c.tar.gz gcc-625dadaf5df5a2ae0d8c5660fd1eec8ba354479c.tar.bz2 |
c++: Fix two issues with auto function parameter [PR99806]
When we have a member function with auto parameter like this:
struct S {
void f(auto);
};
cp_parser_member_declaration -> grokfield produces a FUNCTION_DECL
"void S::foo(auto:1)", and then finish_fully_implicit_template turns
that FUNCTION_DECL into a TEMPLATE_DECL. The bug here is that we only
call cp_parser_save_default_args for a FUNCTION_DECL. As a consequence,
abbrev10.C is rejected because we complain that the default argument has
not been defined, and abbrev11.C ICEs, because we don't re-parse the
delayed noexcept, so the DEFERRED_PARSE tree leaks into tsubst* where we
crash. This patch fixes both issues.
gcc/cp/ChangeLog:
PR c++/99806
* parser.c (cp_parser_member_declaration): Call
cp_parser_save_default_args even for function templates. Use
STRIP_TEMPLATE on the declaration we're passing.
gcc/testsuite/ChangeLog:
PR c++/99806
* g++.dg/concepts/abbrev10.C: New test.
* g++.dg/concepts/abbrev11.C: New test.
Diffstat (limited to 'libgomp/testsuite/libgomp.oacc-c-c++-common/static-variable-1.c')
0 files changed, 0 insertions, 0 deletions