https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85027
--- Comment #5 from Alexandre Oliva <aoliva at gcc dot gnu.org> --- Author: aoliva Date: Sat Mar 31 03:44:12 2018 New Revision: 258989 URL: https://gcc.gnu.org/viewcvs?rev=258989&root=gcc&view=rev Log: [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. Added: trunk/gcc/testsuite/g++.dg/pr85027.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/class.c trunk/gcc/testsuite/ChangeLog