From: Volker Reichelt Date: Mon, 15 May 2006 09:19:30 +0000 (+0000) Subject: re PR c++/27581 (ICE using this-pointer in static member function) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0616700cbc830a751598dce810d82a5116d24a28;p=gcc.git re PR c++/27581 (ICE using this-pointer in static member function) PR c++/27581 * search.c (adjust_result_of_qualified_name_lookup): Skip on invalid context_class. * g++.dg/lookup/this1.C: New test. From-SVN: r113781 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f34ea88fb99..84431385e5c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2006-05-15 Volker Reichelt + PR c++/27581 + * search.c (adjust_result_of_qualified_name_lookup): Skip on + invalid context_class. + PR c++/27315 * pt.c (do_decl_instantiation): Return early on invalid decl. diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 66bbb133da0..6622fb5e20e 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1479,7 +1479,8 @@ adjust_result_of_qualified_name_lookup (tree decl, tree qualifying_scope, tree context_class) { - if (context_class && CLASS_TYPE_P (qualifying_scope) + if (context_class && context_class != error_mark_node + && CLASS_TYPE_P (qualifying_scope) && DERIVED_FROM_P (qualifying_scope, context_class) && BASELINK_P (decl)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index df0864627f3..1dbb9239be7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2006-05-15 Volker Reichelt + PR c++/27581 + * g++.dg/lookup/this1.C: New test. + PR c++/27315 * g++.dg/template/operator6.C: New test. * g++.dg/template/incomplete3.C: New test. diff --git a/gcc/testsuite/g++.dg/lookup/this1.C b/gcc/testsuite/g++.dg/lookup/this1.C new file mode 100644 index 00000000000..20051bf7515 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/this1.C @@ -0,0 +1,8 @@ +// PR c++/27581 +// { dg-do compile } + +struct A +{ + template static void foo(); + static void bar() { this->A::foo<0>(); } // { dg-error "unavailable" } +};