diff options
author | Dodji Seketeli <dodji@redhat.com> | 2009-11-30 09:58:20 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@gcc.gnu.org> | 2009-11-30 10:58:20 +0100 |
commit | 3a3173c9d664cdcb9e2f5f6aeb6cb699bbf9392b (patch) | |
tree | dc000f12a9330d72c0ff8e57bc50e278b1fdcf94 /gcc | |
parent | 92a745f3c4451e13570b1ff7e9d94058d2fa8556 (diff) | |
download | gcc-3a3173c9d664cdcb9e2f5f6aeb6cb699bbf9392b.zip gcc-3a3173c9d664cdcb9e2f5f6aeb6cb699bbf9392b.tar.gz gcc-3a3173c9d664cdcb9e2f5f6aeb6cb699bbf9392b.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/pt.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/typedef23.C | 25 |
4 files changed, 42 insertions, 0 deletions
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 <dodji@redhat.com> + + PR c++/42069 + * pt.c (convert_template_argument): Strip typedefs from SCOPE_REFs. + 2009-11-29 Dodji Seketeli <dodji@redhat.com> 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 <dodji@redhat.com> + + PR c++/42069 + * g++.dg/template/typedef23.C: New test. + 2009-11-29 H.J. Lu <hongjiu.lu@intel.com> 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 <dodji@redhat.com> +// Origin PR c++/42069 +// { dg-do compile } + +struct A +{ + static const int N = 0; +}; + +template<int> struct B {}; + +template<typename T, int> +struct C +{ + typedef T U; + B<U::N> b; +}; + +template<typename T> +struct C<T*, 0> +{ + B<T::N> b; +}; + +C<A*, 0> c; |