[PR87768] reset location wrapper suppression when reentering top level
authorAlexandre Oliva <aoliva@redhat.com>
Thu, 17 Jan 2019 07:32:29 +0000 (07:32 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Thu, 17 Jan 2019 07:32:29 +0000 (07:32 +0000)
commitb00e9be03aa6f95887d0591c88d177f388118534
treeff492ea98b26e8aec3dfef2b01d53f27608732d3
parent33f746e5585fb4da99cded09a44efd49ef2f22c7
[PR87768] reset location wrapper suppression when reentering top level

Concepts-checking and other kinds of early tsubsting may often take
place while location wrappers are suppressed, e.g. because we've
triggered template instantiation within template parameter lists.

With that, exprs that are usually wrapped by VIEW_CONVERT_EXPRs
location wrappers may end up wrapped by NON_LVALUE_EXPRs that are not
marked as location wrappers.  If such NON_LVALUE_EXPRs tsubsted exprs
undergo another round of tsubsting, say for constraint checking, or
even for another round of specialization, they will be rejected by
tsubst_copy_and_build.

This patch arranges for suppress_location_wrappers to be saved and
reset when pushing to the top level, and restored when popping from
it.

for  gcc/cp/ChangeLog

PR c++/87768
* cp-tree.h (saved_scope): Add suppress_location_wrappers.
* name-lookup.c (do_push_to_top_level): Save and reset it.
(do_pop_from_top_level): Restore it.

for  gcc/testsuite/ChangeLog

PR c++/87768
* g++.dg/concepts/pr87768.C: New.

From-SVN: r268006
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/name-lookup.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/concepts/pr87768.C [new file with mode: 0644]