PR c++/52596
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 6 Apr 2012 13:25:45 +0000 (13:25 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 6 Apr 2012 13:25:45 +0000 (13:25 +0000)
* semantics.c (finish_non_static_data_member): In templates, pass
the decl to build_qualified_name.
* tree.c (lvalue_kind) [SCOPE_REF]: Handle FIELD_DECL.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186187 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/cp/tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/qualified-id5.C [new file with mode: 0644]

index 1b93ecd..78c4369 100644 (file)
@@ -1,3 +1,10 @@
+2012-04-05  Jason Merrill  <jason@redhat.com>
+
+       PR c++/52596
+       * semantics.c (finish_non_static_data_member): In templates, pass
+       the decl to build_qualified_name.
+       * tree.c (lvalue_kind) [SCOPE_REF]: Handle FIELD_DECL.
+
 2012-04-04  Jason Merrill  <jason@redhat.com>
 
        PR c++/52845
index 65b771f..9bdd2ee 100644 (file)
@@ -1590,7 +1590,7 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
   else if (processing_template_decl)
     return build_qualified_name (TREE_TYPE (decl),
                                 qualifying_scope,
-                                DECL_NAME (decl),
+                                decl,
                                 /*template_p=*/false);
   else
     {
index 30ad5e1..0577759 100644 (file)
@@ -151,8 +151,14 @@ lvalue_kind (const_tree ref)
       /* A scope ref in a template, left as SCOPE_REF to support later
         access checking.  */
     case SCOPE_REF:
-      gcc_assert (!type_dependent_expression_p (CONST_CAST_TREE(ref)));
-      return lvalue_kind (TREE_OPERAND (ref, 1));
+      gcc_assert (!type_dependent_expression_p (CONST_CAST_TREE (ref)));
+      {
+       tree op = TREE_OPERAND (ref, 1);
+       if (TREE_CODE (op) == FIELD_DECL)
+         return (DECL_C_BIT_FIELD (op) ? clk_bitfield : clk_ordinary);
+       else
+         return lvalue_kind (op);
+      }
 
     case MAX_EXPR:
     case MIN_EXPR:
index cde30ef..946f02e 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-05  Jason Merrill  <jason@redhat.com>
+
+       PR c++/52596
+       * g++.dg/template/qualified-id5.C: New.
+
 2012-04-05  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/52882
diff --git a/gcc/testsuite/g++.dg/template/qualified-id5.C b/gcc/testsuite/g++.dg/template/qualified-id5.C
new file mode 100644 (file)
index 0000000..3126d33
--- /dev/null
@@ -0,0 +1,17 @@
+// PR c++/52596
+
+struct msgpack_zone_finalizer_array {
+    int* tail;
+};
+struct msgpack_zone {
+    msgpack_zone_finalizer_array finalizer_array;
+};
+struct zone : public msgpack_zone {
+    template <typename T> T* allocate();
+
+};
+template <typename T>
+T* zone::allocate()
+{
+  --msgpack_zone::finalizer_array.tail;
+}