From 3a3173c9d664cdcb9e2f5f6aeb6cb699bbf9392b Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Mon, 30 Nov 2009 09:58:20 +0000 Subject: re PR c++/42069 (ICE on class template specialization) Fix PR c++/42069 gcc/cp/ChangeLog: PR c++/42069 * pt.c (convert_template_argument): Strip typedefs from SCOPE_REFs. gcc/testsuite/ChangeLog: PR c++/42069 * g++.dg/template/typedef23.C: New test. From-SVN: r154768 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/template/typedef23.C | 25 +++++++++++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/typedef23.C (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 57ce3cd..e035f3d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2009-11-30 Dodji Seketeli + + PR c++/42069 + * pt.c (convert_template_argument): Strip typedefs from SCOPE_REFs. + 2009-11-29 Dodji Seketeli PR c++/36408 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index dd86cee..9fd06b3 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -5526,6 +5526,13 @@ convert_template_argument (tree parm, if (TYPE_P (val)) val = strip_typedefs (val); } + else if (TREE_CODE (orig_arg) == SCOPE_REF) + { + /* Strip typedefs from the SCOPE_REF. */ + tree type = strip_typedefs (TREE_TYPE (orig_arg)); + tree scope = strip_typedefs (TREE_OPERAND (orig_arg, 0)); + val = build2 (SCOPE_REF, type, scope, TREE_OPERAND (orig_arg, 1)); + } else { tree t = tsubst (TREE_TYPE (parm), args, complain, in_decl); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5ea107d..f09f148 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-11-30 Dodji Seketeli + + PR c++/42069 + * g++.dg/template/typedef23.C: New test. + 2009-11-29 H.J. Lu PR tree-optimization/41961 diff --git a/gcc/testsuite/g++.dg/template/typedef23.C b/gcc/testsuite/g++.dg/template/typedef23.C new file mode 100644 index 0000000..e703550 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/typedef23.C @@ -0,0 +1,25 @@ +// Contributed by Dodji Seketeli +// Origin PR c++/42069 +// { dg-do compile } + +struct A +{ + static const int N = 0; +}; + +template struct B {}; + +template +struct C +{ + typedef T U; + B b; +}; + +template +struct C +{ + B b; +}; + +C c; -- cgit v1.1