From: Volker Reichelt Date: Mon, 15 May 2006 09:26:54 +0000 (+0000) Subject: re PR c++/27581 (ICE using this-pointer in static member function) X-Git-Tag: releases/gcc-4.0.4~690 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee2b7d8015dfd62c4a064c2c76eb130aac717e79;p=thirdparty%2Fgcc.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: r113783 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 58d3c4576592..2773248686a7 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 b712fa25511f..8a91d9a5ae73 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1480,7 +1480,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 2b68cad1a3db..b720772ea5ac 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 000000000000..20051bf7515b --- /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" } +};