+2018-03-31 Alexandre Oliva <aoliva@redhat.com>
+
+ PR c++/85027
+ * class.c (instantiate_type): Peel off SAVE_EXPR before
+ BASELINK.
+
2018-03-30 Jason Merrill <jason@redhat.com>
* typeck2.c (process_init_constructor_record): Use
}
}
+ /* If we instantiate a template, and it is a A ?: C expression
+ with omitted B, look through the SAVE_EXPR. */
+ if (TREE_CODE (rhs) == SAVE_EXPR)
+ rhs = TREE_OPERAND (rhs, 0);
+
if (BASELINK_P (rhs))
{
access_path = BASELINK_ACCESS_BINFO (rhs);
return error_mark_node;
}
- /* If we instantiate a template, and it is a A ?: C expression
- with omitted B, look through the SAVE_EXPR. */
- if (TREE_CODE (rhs) == SAVE_EXPR)
- rhs = TREE_OPERAND (rhs, 0);
-
/* There are only a few kinds of expressions that may have a type
dependent on overload resolution. */
gcc_assert (TREE_CODE (rhs) == ADDR_EXPR
--- /dev/null
+// { dg-do compile }
+
+// Avoid -pedantic-error default
+// { dg-options "" }
+
+struct A { static int a; };
+
+int t = A::A ? : 0; // { dg-error "cannot resolve" }