aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-03-22 16:24:17 -0400
committerJason Merrill <jason@gcc.gnu.org>2013-03-22 16:24:17 -0400
commite0ef0af5357ea927baa6b65bed2ef4a3ad237cc5 (patch)
tree496008590f829d78a4c6c76de8a8c615771fb720 /gcc
parent23b7850d108033107eb0327d4440c43b1f53dbe1 (diff)
downloadgcc-e0ef0af5357ea927baa6b65bed2ef4a3ad237cc5.zip
gcc-e0ef0af5357ea927baa6b65bed2ef4a3ad237cc5.tar.gz
gcc-e0ef0af5357ea927baa6b65bed2ef4a3ad237cc5.tar.bz2
re PR c++/56684 ([C++0x] ICE: unexpected expression 'T' of kind template_parm_index)
PR c++/56684 * pt.c (instantiation_dependent_r): Check DECL_INITIAL of VAR_DECL and CONST_DECL. From-SVN: r196983
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c7
-rw-r--r--gcc/testsuite/g++.dg/template/const6.C7
3 files changed, 20 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e3428ba..0a943a1 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2013-03-22 Jason Merrill <jason@redhat.com>
+
+ PR c++/56684
+ * pt.c (instantiation_dependent_r): Check DECL_INITIAL of VAR_DECL
+ and CONST_DECL.
+
2013-03-21 Gabriel Dos Reis <gdr@integrable-solutions.net>
* cp-tree.h (identifier_p): New.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index b44c632..b6066c1 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -19942,6 +19942,13 @@ instantiation_dependent_r (tree *tp, int *walk_subtrees,
case TREE_VEC:
return NULL_TREE;
+ case VAR_DECL:
+ case CONST_DECL:
+ /* A constant with a dependent initializer is dependent. */
+ if (value_dependent_expression_p (*tp))
+ return *tp;
+ break;
+
case TEMPLATE_PARM_INDEX:
return *tp;
diff --git a/gcc/testsuite/g++.dg/template/const6.C b/gcc/testsuite/g++.dg/template/const6.C
new file mode 100644
index 0000000..3c40d26
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/const6.C
@@ -0,0 +1,7 @@
+// PR c++/56684
+
+template < int T > struct S
+{
+ static const int Ti = T;
+ S() { 1 << Ti; }
+};