OSDN Git Service

PR c++/10635
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 Jun 2003 17:22:29 +0000 (17:22 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 Jun 2003 17:22:29 +0000 (17:22 +0000)
* typeck.c (build_c_cast): Check that the destination type is
complete.

PR c++/10635
* g++.dg/expr/cast1.C: New test.

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

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

index 7e74f47..787643c 100644 (file)
@@ -1,3 +1,9 @@
+2003-06-12  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/10635
+       * typeck.c (build_c_cast): Check that the destination type is
+       complete.
+
 2003-06-11  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/10432
index 21068b3..051d9bc 100644 (file)
@@ -5189,6 +5189,10 @@ build_c_cast (type, expr)
       value = convert_to_void (value, /*implicit=*/NULL);
       return value;
     }
+
+  if (!complete_type_or_else (type, NULL_TREE))
+    return error_mark_node;
+
   /* Convert functions and arrays to pointers and
      convert references to their expanded types,
      but don't convert any other types.  If, however, we are
index 704694a..2dcfe14 100644 (file)
@@ -1,3 +1,8 @@
+2003-06-12  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/10635
+       * g++.dg/expr/cast1.C: New test.
+
 2003-06-12  Roger Sayle  <roger@eyesopen.com>
 
        * gcc.dg/builtins-21.c: New test case.
diff --git a/gcc/testsuite/g++.dg/expr/cast1.C b/gcc/testsuite/g++.dg/expr/cast1.C
new file mode 100644 (file)
index 0000000..ee1adcc
--- /dev/null
@@ -0,0 +1,3 @@
+struct S; // { dg-error "forward" } 
+
+void f(S* p) { ((S) (*p)); } // { dg-error "" }