re PR c++/10682 (chokes on a typedef for an enum inside a class template)
authorKriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
Fri, 23 May 2003 15:01:45 +0000 (15:01 +0000)
committerKriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org>
Fri, 23 May 2003 15:01:45 +0000 (15:01 +0000)
PR c++/10682
* pt.c (instantiate_class_template): Use DECL_ARTIFICIAL to
check for implicitly created typedef to an enum.

* g++.dg/template/instantiate4.C: New test.

From-SVN: r67118

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/instantiate4.C [new file with mode: 0644]

index 4437535..238f56e 100644 (file)
@@ -1,3 +1,9 @@
+2003-05-23  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       PR c++/10682
+       * pt.c (instantiate_class_template): Use DECL_ARTIFICIAL to
+       check for implicitly created typedef to an enum.
+
 2003-05-21  Jason Merrill  <jason@redhat.com>
 
        * init.c (build_vec_delete): Copy the address into a temporary
index c86a157..f775346 100644 (file)
@@ -5500,7 +5500,7 @@ instantiate_class_template (type)
                     CLASSTYPE_NESTED_UTDS case above.  */
                  if (!(TREE_CODE (r) == TYPE_DECL
                        && TREE_CODE (TREE_TYPE (r)) == ENUMERAL_TYPE
-                       && TYPE_CONTEXT (TREE_TYPE (r)) == type))
+                       && DECL_ARTIFICIAL (r)))
                    {
                      set_current_access_from_decl (r);
                      finish_member_declaration (r);
index 6774aea..d0beb83 100644 (file)
@@ -1,3 +1,8 @@
+2003-05-23  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       PR c++/10682
+       * g++.dg/template/instantiate4.C: New test.
+
 2003-05-22  Roger Sayle  <roger@eyesopen.com>
 
        * gcc.c-torture/execute/ieee/inf-2.c: New test case.
diff --git a/gcc/testsuite/g++.dg/template/instantiate4.C b/gcc/testsuite/g++.dg/template/instantiate4.C
new file mode 100644 (file)
index 0000000..732b852
--- /dev/null
@@ -0,0 +1,13 @@
+// { dg-do compile }
+
+// Origin: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
+
+// PR c++/10682: Typedef to enum template instantiation logic.
+
+template <typename T>
+struct Foo {
+  enum E {a,b,c};
+  typedef E EE;
+};
+
+void Baz(Foo<int>::EE x);