]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/5919 (ICE when passing variable array to template function)
authorMark Mitchell <mark@codesourcery.com>
Sun, 1 Dec 2002 20:52:55 +0000 (20:52 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 1 Dec 2002 20:52:55 +0000 (20:52 +0000)
PR c++/5919
* g++.dg/template/varmod1.C: New test.

PR c++/5919
* pt.c (unify): Use variably_modified_type_p to test validity of
template argument types.

From-SVN: r59700

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog

index 9aee794d4f14dc59076074f4d9baa6163406e102..491d6e37b338f619af3cd04024da0da3697abf5f 100644 (file)
@@ -1,3 +1,9 @@
+2002-12-01  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/5919
+       * pt.c (unify): Use variably_modified_type_p to test validity of
+       template argument types.
+
 2002-12-01  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/8727
index b8e95455b5773972dbcabfaf1ca738f14bf4b222..07137c0870dcc3fe5589b9d06f276ea2417ce61c 100644 (file)
@@ -8789,21 +8789,17 @@ unify (tparms, targs, parm, arg, strict)
            return 0;
          else if (targ)
            return 1;
-       }
 
-      /* Make sure that ARG is not a variable-sized array.  (Note that
-        were talking about variable-sized arrays (like `int[n]'),
-        rather than arrays of unknown size (like `int[]').)  We'll
-        get very confused by such a type since the bound of the array
-        will not be computable in an instantiation.  Besides, such
-        types are not allowed in ISO C++, so we can do as we please
-        here.  */
-      if (TREE_CODE (arg) == ARRAY_TYPE 
-         && !uses_template_parms (arg)
-         && TYPE_DOMAIN (arg)
-         && (TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (arg)))
-             != INTEGER_CST))
-       return 1;
+         /* Make sure that ARG is not a variable-sized array.  (Note
+            that were talking about variable-sized arrays (like
+            `int[n]'), rather than arrays of unknown size (like
+            `int[]').)  We'll get very confused by such a type since
+            the bound of the array will not be computable in an
+            instantiation.  Besides, such types are not allowed in
+            ISO C++, so we can do as we please here.  */
+         if (variably_modified_type_p (arg))
+           return 1;
+       }
 
       TREE_VEC_ELT (targs, idx) = arg;
       return 0;
index 9ce6bf1bfcc94c3238759998440d88530c4864f9..e5183a06b3e8272754a56b2fc04fa6c897d23072 100644 (file)
@@ -1,3 +1,8 @@
+2002-12-01  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/5919
+       * g++.dg/template/varmod1.C: New test.
+
 2002-12-01  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/8727