]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
semantics.c (finish_qualified_id_expr): Handle building up a non-dependent SCOPE_REF...
authorJason Merrill <jason@redhat.com>
Fri, 31 Aug 2012 02:50:18 +0000 (22:50 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 31 Aug 2012 02:50:18 +0000 (22:50 -0400)
* 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.

From-SVN: r190829

gcc/cp/ChangeLog
gcc/cp/error.c
gcc/cp/semantics.c

index fc49329ed0d1e4979e5563db1d783265a32a6cc6..c202dc4f0276e9c01dbc836ff5203c931b7518ca 100644 (file)
@@ -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.
index 40f96d33f9bdfbdbfdbdb159a4dfa36d21c5964f..7d60fe00c1862e5d47e47e6a19e5d2e5ccb69caa 100644 (file)
@@ -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:
index d66accfa934cca6f91ea7d9cabd09eab7af72498..6d7004b98a7845edb53bbf07e053dd5983166af9 100644 (file)
@@ -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)
        {