[patch,3.4 branch] Fix fallout from PR c++/17609
Volker Reichelt
reichelt@igpm.rwth-aachen.de
Mon Oct 10 23:00:00 GMT 2005
Hi Gaby,
the following patch fixes some (hopefully all) fallout from the backport
of the patch for PR 17609 to the 3.4 branch:
http://gcc.gnu.org/ml/gcc-patches/2005-09/msg01161.html
It just backports some checks for error_mark_node and related testcases
from mainline/4.0 branch to the 3.4 branch.
Bootstrapped and regtested on i686-pc-linux-gnu.
Ok for the 3.4 branch? Before or after 3.4.5?
(I know, you wanted to postpone this after 3.4.5, but the pre-release
isn't out yet AFAICS, so maybe this is still appropriate for 3.4.5.)
Regards,
Volker
2005-10-10 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
Backport:
2004-09-23 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/17618
* cvt.c (cp_convert_to_pointer): Return early when the type is
an error_mark_node.
2004-05-22 Roger Sayle <roger@eyesopen.com>
* name-lookup.c (check_for_out_of_scope_variable): Avoid ICE by
returning when TREE_TYPE is error_mark_node.
* typeck.c (require_complete_type): Return error_mark_node if
value's type is an error_mark_node.
2004-11-02 Mark Mitchell <mark@codesourcery.com>
PR c++/18177
* typeck.c (build_const_cast): Use error_operand_p.
===================================================================
--- gcc/gcc/cp/cvt.c 11 Jun 2005 00:16:00 -0000 1.151.4.4
+++ gcc/gcc/cp/cvt.c 22 Sep 2005 11:37:46 -0000
@@ -79,6 +79,8 @@ cp_convert_to_pointer (tree type, tree e
tree intype = TREE_TYPE (expr);
enum tree_code form;
tree rval;
+ if (intype == error_mark_node)
+ return error_mark_node;
if (IS_AGGR_TYPE (intype))
{
===================================================================
--- gcc/gcc/cp/name-lookup.c 2004/05/14 22:33:28 1.52
+++ gcc/gcc/cp/name-lookup.c 2004/05/22 13:56:13 1.53
@@ -1179,6 +1179,10 @@
return decl;
DECL_ERROR_REPORTED (decl) = 1;
+
+ if (TREE_TYPE (decl) == error_mark_node)
+ return decl;
+
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (decl)))
{
error ("name lookup of `%D' changed for new ISO `for' scoping",
===================================================================
--- gcc/gcc/cp/typeck.c 1 Sep 2005 15:06:00 -0000 1.519.2.30
+++ gcc/gcc/cp/typeck.c 22 Sep 2005 11:40:05 -0000
@@ -95,6 +95,9 @@ require_complete_type (tree value)
else
type = TREE_TYPE (value);
+ if (type == error_mark_node)
+ return error_mark_node;
+
/* First, detect a valid value with a complete type. */
if (COMPLETE_TYPE_P (type))
return value;
@@ -4794,7 +4797,7 @@ build_const_cast (tree type, tree expr)
{
tree intype;
- if (type == error_mark_node || expr == error_mark_node)
+ if (type == error_mark_node || error_operand_p (expr))
return error_mark_node;
if (processing_template_decl)
===================================================================
2005-10-10 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
Backport:
2004-09-23 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/17618
* g++.dg/lookup/crash5.C: New test.
2004-05-22 Wolfgang Bangerth <bangerth@dealii.org>
Roger Sayle <roger@eyesopen.com>
* g++.dg/lookup/forscope2.C: New test case.
2004-11-02 Mark Mitchell <mark@codesourcery.com>
PR c++/18177
* g++.dg/conversion/const3.C: New test.
===================================================================
--- gcc/gcc/testsuite/g++.dg/lookup/crash5.C
+++ gcc/gcc/testsuite/g++.dg/lookup/crash5.C 2005-10-10 19:09:14.576604000 +0000
@@ -0,0 +1,9 @@
+// { dg-do compile }
+//
+// PR 17618
+
+void foo()
+{
+ p; // { dg-error "not declared" }
+ (void*) p;
+}
===================================================================
--- gcc/gcc/testsuite/g++.dg/lookup/forscope2.C
+++ gcc/gcc/testsuite/g++.dg/lookup/forscope2.C 2005-10-10 19:20:39.033740000 +0000
@@ -0,0 +1,9 @@
+// { dg-do compile }
+
+struct S {
+ void foo() {
+ for (_ptr; ;) {} // { dg-error "not declared" }
+ _ptr = 0;
+ }
+};
+
===================================================================
--- gcc/gcc/testsuite/g++.dg/conversion/const3.C
+++ gcc/gcc/testsuite/g++.dg/conversion/const3.C 2005-10-10 19:12:34.844864000 +0000
@@ -0,0 +1,7 @@
+// PR c++/18177
+
+void foo()
+{
+ X; // { dg-error "" }
+ const_cast<int&>(X);
+}
===================================================================
More information about the Gcc-patches
mailing list