* decl2.c (grokfield): Remangle the name of a member TYPE_DECL.
authorMark Mitchell <mmitchell@usa.net>
Tue, 21 Apr 1998 22:08:05 +0000 (22:08 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 21 Apr 1998 22:08:05 +0000 (22:08 +0000)
From-SVN: r19369

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/g++.old-deja/g++.pt/typedef3.C [new file with mode: 0644]

index cffacb0e2f34342598529964bff8d393e9b6c638..9e690446789742edb487d3f8b5411e1c2be4fb42 100644 (file)
@@ -5,6 +5,8 @@ Tue Apr 21 22:00:04 1998  Mark Mitchell  <mmitchell@usa.net>
        * decl2.c (check_member_template): Set DECL_IGNORED for member
        class templates, too.
 
+       * decl2.c (grokfield): Remangle the name of a member TYPE_DECL.
+
 Tue Apr 21 18:59:11 1998  Benjamin Kosnik  <bkoz@rhino.cygnus.com>
 
        * decl.c (duplicate_decls): Only check DECL_FRIEND_P if function.
index 6b24edc0e0ec3e84ee03b78b449067ca631a876b..52900c478c8697552fc4c09f5d2aaa64e5cabf99 100644 (file)
@@ -1579,6 +1579,12 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
       DECL_CLASS_CONTEXT (value) = current_class_type;
       CLASSTYPE_LOCAL_TYPEDECLS (current_class_type) = 1;
 
+      /* Now that we've updated the context, we need to remangle the
+        name for this TYPE_DECL.  */
+      DECL_ASSEMBLER_NAME (value) = DECL_NAME (value);
+      DECL_ASSEMBLER_NAME (value) =
+       get_identifier (build_overload_name (TREE_TYPE (value), 1, 1));
+
       pushdecl_class_level (value);
       return value;
     }
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typedef3.C b/gcc/testsuite/g++.old-deja/g++.pt/typedef3.C
new file mode 100644 (file)
index 0000000..110e481
--- /dev/null
@@ -0,0 +1,25 @@
+// Build don't link:
+
+template <class T>
+void f(T, T)
+{
+}
+
+struct A {
+  typedef enum {
+    VAL1
+  } result_t;
+};
+
+struct B {
+  typedef enum {
+    VAL2
+  } result_t;
+};
+
+
+void g()
+{
+  f(A::VAL1, A::VAL1);
+  f(B::VAL2, B::VAL2);
+}