summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2012-08-31 02:50:18 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2012-08-31 02:50:18 +0000
commitd0b4bf064cc775c510f804bee8394067530cc2bb (patch)
tree6ecc82815289eebd6a77e97ed6cd46d01aa3ce7e
parentabcd2504cabc450b2eb467a4918270ed4f97d70a (diff)
downloadgcc-d0b4bf064cc775c510f804bee8394067530cc2bb.tar.gz
* semantics.c (finish_qualified_id_expr): Handle building up a
non-dependent SCOPE_REF here. (finish_id_expression): Not here. * error.c (dump_decl) [SCOPE_REF]: Only pass TFF_UNQUALIFIED_NAME. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190829 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/error.c2
-rw-r--r--gcc/cp/semantics.c35
3 files changed, 25 insertions, 17 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fc49329ed0d..c202dc4f027 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,10 @@
2012-08-30 Jason Merrill <jason@redhat.com>
+ * semantics.c (finish_qualified_id_expr): Handle building up a
+ non-dependent SCOPE_REF here.
+ (finish_id_expression): Not here.
+ * error.c (dump_decl) [SCOPE_REF]: Only pass TFF_UNQUALIFIED_NAME.
+
* friend.c (make_friend_class): Handle template template parameters.
* parser.c (cp_parser_template_declaration_after_export): Likewise.
* pt.c (tsubst_friend_class): Likewise.
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 40f96d33f9b..7d60fe00c18 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -1042,7 +1042,7 @@ dump_decl (tree t, int flags)
case SCOPE_REF:
dump_type (TREE_OPERAND (t, 0), flags);
pp_string (cxx_pp, "::");
- dump_decl (TREE_OPERAND (t, 1), flags|TFF_UNQUALIFIED_NAME);
+ dump_decl (TREE_OPERAND (t, 1), TFF_UNQUALIFIED_NAME);
break;
case ARRAY_REF:
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index d66accfa934..6d7004b98a7 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1792,6 +1792,23 @@ finish_qualified_id_expr (tree qualifying_class,
being taken. */
expr = build_offset_ref (qualifying_class, expr, /*address_p=*/false);
}
+ else if (BASELINK_P (expr))
+ ;
+ else
+ {
+ expr = convert_from_reference (expr);
+
+ /* In a template, return a SCOPE_REF for most qualified-ids
+ so that we can check access at instantiation time. But if
+ we're looking at a member of the current instantiation, we
+ know we have access and building up the SCOPE_REF confuses
+ non-type template argument handling. */
+ if (processing_template_decl
+ && !currently_open_class (qualifying_class))
+ expr = build_qualified_name (TREE_TYPE (expr),
+ qualifying_class, expr,
+ template_p);
+ }
return expr;
}
@@ -3253,7 +3270,7 @@ finish_id_expression (tree id_expression,
if (TREE_CODE (decl) == FUNCTION_DECL)
mark_used (decl);
- if (TREE_CODE (decl) == FIELD_DECL || BASELINK_P (decl))
+ if (TYPE_P (scope))
decl = finish_qualified_id_expr (scope,
decl,
done,
@@ -3261,21 +3278,7 @@ finish_id_expression (tree id_expression,
template_p,
template_arg_p);
else
- {
- tree r = convert_from_reference (decl);
-
- /* In a template, return a SCOPE_REF for most qualified-ids
- so that we can check access at instantiation time. But if
- we're looking at a member of the current instantiation, we
- know we have access and building up the SCOPE_REF confuses
- non-type template argument handling. */
- if (processing_template_decl && TYPE_P (scope)
- && !currently_open_class (scope))
- r = build_qualified_name (TREE_TYPE (r),
- scope, decl,
- template_p);
- decl = r;
- }
+ decl = convert_from_reference (decl);
}
else if (TREE_CODE (decl) == FIELD_DECL)
{