re PR c++/27581 (ICE using this-pointer in static member function)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Mon, 15 May 2006 09:19:30 +0000 (09:19 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Mon, 15 May 2006 09:19:30 +0000 (09:19 +0000)
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

gcc/cp/ChangeLog
gcc/cp/search.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lookup/this1.C [new file with mode: 0644]

index f34ea88fb99541127f0a8be83b6f9f6cad80ca2c..84431385e5ca9468cc13a9bfc073456d3b23db06 100644 (file)
@@ -1,5 +1,9 @@
 2006-05-15  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       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.
 
index 66bbb133da0c13d9a62537e851bea6e8b299bab2..6622fb5e20e3ec58d5d5b6884b78c2a2c01c0bbd 100644 (file)
@@ -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))
     {
index df0864627f3f18797f6cf648632f47d48bd0afe0..1dbb9239be740260a93e747a30e42256ad49ece1 100644 (file)
@@ -1,5 +1,8 @@
 2006-05-15  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       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 (file)
index 0000000..20051bf
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/27581
+// { dg-do compile }
+
+struct A
+{
+    template<int> static void foo();
+    static void bar() { this->A::foo<0>(); } // { dg-error "unavailable" }
+};