From: Kriang Lerdsuwanakij Date: Fri, 23 May 2003 15:01:45 +0000 (+0000) Subject: re PR c++/10682 (chokes on a typedef for an enum inside a class template) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=43b26a012874897cecbd2cf48e09a08368191282;p=gcc.git re PR c++/10682 (chokes on a typedef for an enum inside a class template) 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 44375350950..238f56e2f9e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2003-05-23 Kriang Lerdsuwanakij + + 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 * init.c (build_vec_delete): Copy the address into a temporary diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c86a1573c43..f775346b163 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6774aeac0a6..d0beb83bc38 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-05-23 Kriang Lerdsuwanakij + + PR c++/10682 + * g++.dg/template/instantiate4.C: New test. + 2003-05-22 Roger Sayle * 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 index 00000000000..732b8529de2 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/instantiate4.C @@ -0,0 +1,13 @@ +// { dg-do compile } + +// Origin: Wolfgang Bangerth + +// PR c++/10682: Typedef to enum template instantiation logic. + +template +struct Foo { + enum E {a,b,c}; + typedef E EE; +}; + +void Baz(Foo::EE x);