pt.c (process_template_parm): Ignore top-level qualifiers on non-type parameters.
authorMark Mitchell <mark@markmitchell.com>
Fri, 15 Jan 1999 18:34:48 +0000 (18:34 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 15 Jan 1999 18:34:48 +0000 (18:34 +0000)
* pt.c (process_template_parm): Ignore top-level qualifiers on
non-type parameters.
* decl.c (start_function): Use current_function_parms in the call
to require_complete_type_for_parms, not the probably empty
DECL_ARGUMENTS.

From-SVN: r24684

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/pt.c
gcc/testsuite/g++.old-deja/g++.other/incomplete.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/crash26.C [new file with mode: 0644]

index a0145167ed918c1a2250988e77876718560d0b86..c0daba4189e2abbe4177ea0f20826647d2772a62 100644 (file)
@@ -1,3 +1,12 @@
+1999-01-15  Mark Mitchell  <mark@markmitchell.com>
+
+       * pt.c (process_template_parm): Ignore top-level qualifiers on
+       non-type parameters.
+
+       * decl.c (start_function): Use current_function_parms in the call
+       to require_complete_type_for_parms, not the probably empty
+       DECL_ARGUMENTS.
+
 1999-01-14  Jason Merrill  <jason@yorick.cygnus.com>
 
        * semantics.c (finish_asm_stmt): Don't warn about redundant volatile.
index bf887d2918d4d2b77109d8d0cf64a7c07a05cfa6..5e603b6d4804644b0534ee36851e726726daf7be 100644 (file)
@@ -12860,8 +12860,8 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
 
   if (! processing_template_decl)
     {
-      /* In a fcn definition, arg types must be complete.  */
-      require_complete_types_for_parms (DECL_ARGUMENTS (decl1));
+      /* In a function definition, arg types must be complete.  */
+      require_complete_types_for_parms (current_function_parms);
 
       if (TYPE_SIZE (complete_type (TREE_TYPE (fntype))) == NULL_TREE)
        {
index fea1c345be84784e37f275cc0d215dc6a5c5f1a9..a28751b0386831079d5bfde37d784175950757e0 100644 (file)
@@ -1591,6 +1591,13 @@ process_template_parm (list, next)
       /* is a const-param */
       parm = grokdeclarator (TREE_VALUE (parm), TREE_PURPOSE (parm),
                             PARM, 0, NULL_TREE);
+
+      /* [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));
+
       /* A template parameter is not modifiable.  */
       TREE_READONLY (parm) = 1;
       if (IS_AGGR_TYPE (TREE_TYPE (parm))
diff --git a/gcc/testsuite/g++.old-deja/g++.other/incomplete.C b/gcc/testsuite/g++.old-deja/g++.other/incomplete.C
new file mode 100644 (file)
index 0000000..0c230c1
--- /dev/null
@@ -0,0 +1,5 @@
+// Build don't link:
+
+struct S;
+
+void f(S s) {} // ERROR - incomplete type
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash26.C b/gcc/testsuite/g++.old-deja/g++.pt/crash26.C
new file mode 100644 (file)
index 0000000..d2101bd
--- /dev/null
@@ -0,0 +1,15 @@
+// Build don't link:
+// Origin: Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
+
+double f(double);
+typedef double (*M)(double);
+
+class A {
+public:
+       template <const M n> void g(); 
+};
+
+class B: public A {
+public:
+       void g() { A::g<f>(); }
+};