c++: Make OMP UDR DECL_LOCAL_DECL_P earlier
authorNathan Sidwell <nathan@acm.org>
Wed, 28 Oct 2020 18:42:11 +0000 (11:42 -0700)
committerNathan Sidwell <nathan@acm.org>
Wed, 28 Oct 2020 18:46:46 +0000 (11:46 -0700)
commit4289e488dddc1f07a04feca6568b329f65b8fa10
treee941454e9c051b81fe83c85a6ed511336d0b0e7a
parenta3c13696fd2e18e6e2de52b25ddfe72284335732
c++: Make OMP UDR DECL_LOCAL_DECL_P earlier

I discovered that we were pushing an OMP UDR in a template before
setting DECL_LOCAL_DECL.  This caused the template machinery to give
it some template info.  It doesn't need that, and this changes the
parser to set it earlier.  We have to adjust instantiate_body to not
try and access such a function's non-existant template_info.  The
access checks that we're no longer doing are the same as those we did
on the containing function anyway.  So nothing is lost.

gcc/cp/
* parser.c (cp_parser_omp_declare_reduction): Set
DECL_LOCAL_DECL_P before push_template_decl.
* pt.c (instantiate_body): Nested fns do not have template_info.
gcc/cp/parser.c
gcc/cp/pt.c