The following invalid testcase triggers an ICE since GCC 3.4.0:
===============================================
struct A
{
template<int> static void foo();
static void bar() { this->A::foo<0>(); }
};
===============================================
bug.cc: In static member function 'static void A::bar()':
bug.cc:4: error: 'this' is unavailable for static member functions
bug.cc:4: internal compiler error: in adjust_result_of_qualified_name_lookup,
at cp/search.c:1488
Please submit a full bug report, [etc.]
Patch on the way.
--
Summary: [4.0/4.1/4.2 regression] ICE using this-pointer in
static member function
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: ice-on-invalid-code, error-recovery, monitored
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: reichelt at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27581