summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-30 09:58:20 +0000
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-30 09:58:20 +0000
commit92d7a451bc1093930f14896b59bf02d61843d5b6 (patch)
treedc000f12a9330d72c0ff8e57bc50e278b1fdcf94
parentb68acde5971b7395378c27317b490f16474ad979 (diff)
downloadgcc-92d7a451bc1093930f14896b59bf02d61843d5b6.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154768 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/pt.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/typedef23.C25
4 files changed, 42 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 57ce3cd58ff..e035f3ddad7 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 dd86ceeb682..9fd06b3433f 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 5ea107d0a09..f09f148f3f8 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 00000000000..e70355037f7
--- /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;