]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/19208 (Spurious error about variably modified type)
authorGiovanni Bajo <giovannibajo@gcc.gnu.org>
Mon, 25 Jul 2005 21:13:18 +0000 (21:13 +0000)
committerGiovanni Bajo <giovannibajo@gcc.gnu.org>
Mon, 25 Jul 2005 21:13:18 +0000 (21:13 +0000)
cp/
PR c++/19208
* pt.c (tsubst): Use fold_non_dependent_expr to fold array domains.

testsuite/
PR c++/19208
* g++.dg/template/array11.C: New test.

From-SVN: r102370

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/array11.C

index caaefb9fd0db7d14c51afef034ed34b504cdd2ff..676dbcc2d08da81e124cd1202ababe2b9f0476ad 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-25  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
+
+       PR c++/19208
+       * pt.c (tsubst): Use fold_non_dependent_expr to fold array domains.
+
 2005-06-14  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/21987
index ac0f8ceae28879fe715da53abc8f6fdb22225417..c61b26b4134e792398ab1a01244f6e3c0fb292ce 100644 (file)
@@ -6720,8 +6720,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
        /* The array dimension behaves like a non-type template arg,
           in that we want to fold it as much as possible.  */
        max = tsubst_template_arg (omax, args, complain, in_decl);
-       if (!processing_template_decl)
-         max = decl_constant_value (max);
+       max = fold_non_dependent_expr (max);
 
        if (integer_zerop (omax))
          {
index 15e86a758579d4b2e9c4d5dc077601fb3f601fab..7233b8c65a980d82a15b4240462705b62023bd80 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-25  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
+
+       PR c++/19208
+       * g++.dg/template/array11.C: New test.
+
 2005-07-21  Janis Johnson  <janis187@us.ibm.com>
 
        PR target/20191
index 259c9fabc036b8068e6384f113971de302ea5038..cac087aece55714819ab5a0fdc79d4b0c7591e0f 100644 (file)
@@ -1,14 +1,17 @@
-// { dg-do compile }
-// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
-// PR c++/19208: Fold dependent array domains
-
-template <class C> struct if_t { typedef int type; };
-template <class T> struct ffff { static const bool value = true; };
-template <class A>
-struct bound_member_action
-{
-  typedef char f[ffff<A>::value ? 1 : 2];
-  template <class CT>
-    bound_member_action(CT i, typename if_t<f>::type g)  {}
-};
-bound_member_action<int> a(0, 1);
+// { dg-do compile }\r
+// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>\r
+// PR c++/19208: Fold dependent array domains\r
+\r
+template <class C> struct if_t { typedef int type; };\r
+template <class T> struct hhhh { static const bool value = true; };\r
+template <class T> struct gggg { static const bool value = hhhh<T>::value; };\r
+template <class T> struct ffff { static const bool value = gggg<T>::value; };\r
+template <class A>\r
+struct bound_member_action\r
+{\r
+  typedef char f[ffff<A>::value ? 1 : 2];\r
+  template <class CT>\r
+  bound_member_action(CT i, typename if_t<f>::type g)  {}\r
+};\r
+\r
+bound_member_action<int> a(0, 1);\r