summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-02-05 20:03:30 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-02-05 20:03:30 +0000
commitdf017c59ab31db4d0480b7666662737a4b7acf12 (patch)
tree02867e06e7df6e85d8215596e964e59f181c435d
parent840638ec9abec54ffccc983d4196c9057be0c6cb (diff)
downloadgcc-df017c59ab31db4d0480b7666662737a4b7acf12.tar.gz
PR c++/33553
* pt.c (tsubst) <case INTEGER_TYPE>: Don't issue error if max is value dependent expression. * g++.dg/template/array19.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132126 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/array19.C22
4 files changed, 36 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5ea0490684c..00c96e79aeb 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/33553
+ * pt.c (tsubst) <case INTEGER_TYPE>: Don't issue error if max is
+ value dependent expression.
+
2008-02-05 Douglas Gregor <doug.gregor@gmail.com>
PR c++/35074
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 2b996d41ae1..b62cc3dbaa5 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -8894,9 +8894,9 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
/*integral_constant_expression_p=*/false);
max = fold_decl_constant_value (max);
- if (TREE_CODE (max) != INTEGER_CST
- && TREE_CODE (max) != TEMPLATE_PARM_INDEX
- && !at_function_scope_p ())
+ if (TREE_CODE (max) != INTEGER_CST
+ && !at_function_scope_p ()
+ && !value_dependent_expression_p (max))
{
if (complain & tf_error)
error ("array bound is not an integer constant");
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 843406430dc..893f7277905 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-02-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/33553
+ * g++.dg/template/array19.C: New test.
+
2008-02-05 Diego Novillo <dnovillo@google.com>
http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00140.html
diff --git a/gcc/testsuite/g++.dg/template/array19.C b/gcc/testsuite/g++.dg/template/array19.C
new file mode 100644
index 00000000000..79abf47c17a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/array19.C
@@ -0,0 +1,22 @@
+// PR c++/33553
+// { dg-do compile }
+
+template <class T> struct S { static const int sz = 2; };
+template <class T> struct U { enum { sz = 2 }; };
+
+template <class R>
+struct P
+{
+ template <class T> void bar (int (&x)[S<T>::sz]);
+ template <class T> void baz (int (&x)[U<T>::sz]);
+};
+
+P<int> p;
+
+void
+foo (void)
+{
+ int x[2];
+ p.bar<int> (x);
+ p.baz<int> (x);
+}