aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index e146abc..3db223a 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -5864,6 +5864,15 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
if (TREE_CODE (rhs) == BASELINK)
rhs = BASELINK_FUNCTIONS (rhs);
+ /* If we are in a template, and have a NON_DEPENDENT_EXPR, we cannot
+ deduce any type information. */
+ if (TREE_CODE (rhs) == NON_DEPENDENT_EXPR)
+ {
+ if (flags & tf_error)
+ error ("not enough type information");
+ return error_mark_node;
+ }
+
/* We don't overwrite rhs if it is an overloaded function.
Copying it would destroy the tree link. */
if (TREE_CODE (rhs) != OVERLOAD)
@@ -5904,14 +5913,15 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
case COMPONENT_REF:
{
- tree addr = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags);
+ tree member = TREE_OPERAND (rhs, 1);
- if (addr != error_mark_node
+ member = instantiate_type (lhstype, member, flags);
+ if (member != error_mark_node
&& TREE_SIDE_EFFECTS (TREE_OPERAND (rhs, 0)))
/* Do not lose object's side effects. */
- addr = build2 (COMPOUND_EXPR, TREE_TYPE (addr),
- TREE_OPERAND (rhs, 0), addr);
- return addr;
+ return build2 (COMPOUND_EXPR, TREE_TYPE (member),
+ TREE_OPERAND (rhs, 0), member);
+ return member;
}
case OFFSET_REF:
@@ -5943,12 +5953,6 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
/*template_only=*/false,
/*explicit_targs=*/NULL_TREE);
- case TREE_LIST:
- /* Now we should have a baselink. */
- gcc_assert (BASELINK_P (rhs));
-
- return instantiate_type (lhstype, BASELINK_FUNCTIONS (rhs), flags);
-
case CALL_EXPR:
/* This is too hard for now. */
gcc_unreachable ();