[PR c++/85027] deal with baselink in save_expr in instantiate_type
commit83e55acb495979d66f3568cd3811cc9c04ff8afc
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 31 Mar 2018 03:44:12 +0000 (31 03:44 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 31 Mar 2018 03:44:12 +0000 (31 03:44 +0000)
treeaa2d7f2777c76281bd8764c9a564d0ce67a0b79f
parentcbe111d4e27ee25357e02f7606885c3b32c915fc
[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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@258989 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr85027.C [new file with mode: 0644]