PR c++/27430
authorreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 6 May 2006 00:40:40 +0000 (00:40 +0000)
committerreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 6 May 2006 00:40:40 +0000 (00:40 +0000)
* pt.c (process_template_parm): Handle erroneous non-type parameters.

* g++.dg/template/void1.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113572 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/void1.C [new file with mode: 0644]

index 31e40de..2fcb893 100644 (file)
@@ -1,5 +1,8 @@
 2006-05-06  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c++/27430
+       * pt.c (process_template_parm): Handle erroneous non-type parameters.
+
        PR c++/27423
        * typeck.c (convert_for_initialization): Skip erroneous types.
 
index 7b814ae..614de41 100644 (file)
@@ -2347,18 +2347,23 @@ process_template_parm (tree list, tree next, bool is_non_type)
 
       SET_DECL_TEMPLATE_PARM_P (parm);
 
-      /* [temp.param]
+      if (TREE_TYPE (parm) == error_mark_node)
+       TREE_TYPE (parm) = void_type_node;
+      else
+      {
+       /* [temp.param]
 
-        The top-level cv-qualifiers on the template-parameter are
-        ignored when determining its type.  */
-      TREE_TYPE (parm) = TYPE_MAIN_VARIANT (TREE_TYPE (parm));
+          The top-level cv-qualifiers on the template-parameter are
+          ignored when determining its type.  */
+       TREE_TYPE (parm) = TYPE_MAIN_VARIANT (TREE_TYPE (parm));
+       if (invalid_nontype_parm_type_p (TREE_TYPE (parm), 1))
+         TREE_TYPE (parm) = void_type_node;
+      }
 
       /* A template parameter is not modifiable.  */
       TREE_CONSTANT (parm) = 1;
       TREE_INVARIANT (parm) = 1;
       TREE_READONLY (parm) = 1;
-      if (invalid_nontype_parm_type_p (TREE_TYPE (parm), 1))
-       TREE_TYPE (parm) = void_type_node;
       decl = build_decl (CONST_DECL, DECL_NAME (parm), TREE_TYPE (parm));
       TREE_CONSTANT (decl) = 1;
       TREE_INVARIANT (decl) = 1;
index a51b52d..d259e40 100644 (file)
@@ -1,5 +1,8 @@
 2006-05-06  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c++/27430
+       * g++.dg/template/void1.C: New test.
+
        PR c++/27423
        * g++.dg/other/void2.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/template/void1.C b/gcc/testsuite/g++.dg/template/void1.C
new file mode 100644 (file)
index 0000000..732e9d0
--- /dev/null
@@ -0,0 +1,4 @@
+// PR c++/27430
+// { dg-do compile }
+
+template<void[]> struct A;  // { dg-error "array of void" }