re PR c++/12184 (ICE with trying to convert an incomplete type)
authorNathan Sidwell <nathan@codesourcery.com>
Mon, 15 Sep 2003 14:48:29 +0000 (14:48 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Mon, 15 Sep 2003 14:48:29 +0000 (14:48 +0000)
cp:
PR c++/12184
* typeck.c (convert_arguments): Return error_mark_node for an
incomplete parameter. Make error message more informative.
testsuite:
PR c++/12184
* g++.dg/expr/call2.C: New test.

From-SVN: r71402

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

index 374e7e57e66986b1b0e3e211b5caa5dbba5c97b8..815a5538bff1c42bf1aa4c43269b4d4861af83d4 100644 (file)
@@ -1,3 +1,9 @@
+2003-09-15  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR c++/12184
+       * typeck.c (convert_arguments): Return error_mark_node for an
+       incomplete parameter. Make error message more informative.
+
 2003-09-12  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/3907
index f829095a1e151334e77b07e22c12ee29e7f320f7..28ed0bcd232b81339fff238cfb21964b95b624ad 100644 (file)
@@ -5254,12 +5254,14 @@ instantiate_class_template (tree type)
                  if (TYPE_LANG_SPECIFIC (tag) && CLASSTYPE_IS_TEMPLATE (tag))
                    /* Unfortunately, lookup_template_class sets
                       CLASSTYPE_IMPLICIT_INSTANTIATION for a partial
-                      instantiation (i.e., for the type of a member template
-                      class nested within a template class.)  This behavior is
-                      required for maybe_process_partial_specialization to work
-                      correctly, but is not accurate in this case; the TAG is not
-                      an instantiation of anything.  (The corresponding
-                      TEMPLATE_DECL is an instantiation, but the TYPE is not.) */
+                      instantiation (i.e., for the type of a member
+                      template class nested within a template class.)
+                      This behavior is required for
+                      maybe_process_partial_specialization to work
+                      correctly, but is not accurate in this case;
+                      the TAG is not an instantiation of anything.
+                      (The corresponding TEMPLATE_DECL is an
+                      instantiation, but the TYPE is not.) */
                    CLASSTYPE_USE_TEMPLATE (newtag) = 0;
 
                  /* Now, we call pushtag to put this NEWTAG into the scope of
index 32ec44b46792161b447d88f66ef2777351f5433d..8f1171f8ee1f8c06ca85219226f82c2208477102 100644 (file)
@@ -2532,8 +2532,12 @@ convert_arguments (tree typelist, tree values, tree fndecl, int flags)
 
          if (!COMPLETE_TYPE_P (complete_type (type)))
            {
-             error ("parameter type of called function is incomplete");
-             parmval = val;
+             if (fndecl)
+               error ("parameter %P of `%D' has incomplete type `%T'",
+                      i, fndecl, type);
+             else
+               error ("parameter %P has incomplete type `%T'", i, type);
+             parmval = error_mark_node;
            }
          else
            {
index c9c3b28ff39f3df80f074c12e73391ae6dd319dd..82de8cebc1eebdfca9d70c44e358c3aa45d524f2 100644 (file)
@@ -1,3 +1,8 @@
+2003-09-15  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR c++/12184
+       * g++.dg/expr/call2.C: New test.
+
 2003-09-15  Andreas Jaeger  <aj@suse.de>
 
        * gcc.dg/Wold-style-definition-1.c: New test.
diff --git a/gcc/testsuite/g++.dg/expr/call2.C b/gcc/testsuite/g++.dg/expr/call2.C
new file mode 100644 (file)
index 0000000..3b7398a
--- /dev/null
@@ -0,0 +1,14 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 11 Sep 2003 <nathan@codesourcery.com>
+// Origin: Wolfgang Bangerth <bangerth@dealii.org> 
+// PR c++/12184. ICE
+
+class C; 
+class D;
+bool mm(D); 
+void g(C& f) { 
+  mm(f); // { dg-error "parameter" "" }
+}