[PR c++/85027] deal with baselink in save_expr in instantiate_type
authorAlexandre Oliva <aoliva@redhat.com>
Sat, 31 Mar 2018 03:44:12 +0000 (03:44 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Sat, 31 Mar 2018 03:44:12 +0000 (03:44 +0000)
commitfc8b67411812f81151b4fa3dfcc0bd378e2d5cf8
treeaa2d7f2777c76281bd8764c9a564d0ce67a0b79f
parentec8d8a5b5c1cf75cd62b908e2ace053ed2b05ec2
[PR c++/85027] deal with baselink in save_expr in instantiate_type

We use SAVE_EXPRs in conditional expressions without the middle
operand, to evaluate the first operand only once.  When the conversion
of the first operand fails, we may call instantiate_type get a better
error message.  We have code to peel off the SAVE_EXPR there, but then
we may end up with a BASELINK, and we're past the code that deals with
BASELINKs.  Reorder the tests so that we expose the saved expr first,
and then deal with BASELINKs.

for  gcc/cp/ChangeLog

PR c++/85027
* class.c (instantiate_type): Peel off SAVE_EXPR before
BASELINK.

for  gcc/testsuite/ChangeLog

PR c++/85027
* g++.dg/pr85027.C: New.

From-SVN: r258989
gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr85027.C [new file with mode: 0644]