commit d3a8f99d0ae9caf8d344b44a8e66632181a20157
Author: Jason Merrill <jason@redhat.com>
Date: Fri Mar 22 12:27:01 2013 -0400
PR c++/56684
* pt.c (instantiation_dependent_r): Check DECL_INITIAL of VAR_DECL
and CONST_DECL.
@@ -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;
new file mode 100644
@@ -0,0 +1,7 @@
+// PR c++/56684
+
+template < int T > struct S
+{
+ static const int Ti = T;
+ S() { 1 << Ti; }
+};