re PR c++/11149 (ICE on error when instantiation with call function of a base type)
authorMark Mitchell <mark@codesourcery.com>
Tue, 1 Jul 2003 17:36:00 +0000 (17:36 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 1 Jul 2003 17:36:00 +0000 (17:36 +0000)
PR c++/11149
* call.c (resolve_scoped_fn_name): Check that the qualifying scope
is a class type.

PR c++/11149
* g++.dg/lookup/scoped6.C: New test.

From-SVN: r68782

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

index 5487d3375a766b6dbe900aa2d6b729a2336090ff..e9180bfeb85a7b6f2c12bf57a6008d50f7a3fe43 100644 (file)
@@ -1,3 +1,9 @@
+2003-07-01  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/11149
+       * call.c (resolve_scoped_fn_name): Check that the qualifying scope
+       is a class type.
+
 2003-07-01  Giovanni Bajo  <giovannibajo@libero.it>
        
         PR c++/8046
index d92a24e699a18bd7591ddbfd98c89dad67fe9393..0f4d360496ac9ed044924ea9ccf75721ba4206d5 100644 (file)
@@ -2765,6 +2765,8 @@ resolve_scoped_fn_name (tree scope, tree name)
   
   if (TREE_CODE (scope) == NAMESPACE_DECL)
     fn = lookup_namespace_name (scope, name);
+  else if (!CLASS_TYPE_P (scope))
+    error ("`%T' is not a class type", scope);
   else
     {
       if (!TYPE_BEING_DEFINED (scope)
index 95e4e01d48aac2fdb168b7545c01046398af0948..86cabcb6cfa7ed21efb9c7475c27e1ec6e96c751 100644 (file)
@@ -1,3 +1,8 @@
+2003-07-01  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/11149
+       * g++.dg/lookup/scoped6.C: New test.
+
 2003-07-01  Giovanni Bajo  <giovannibajo@libero.it>
 
         PR c++/8046
diff --git a/gcc/testsuite/g++.dg/lookup/scoped6.C b/gcc/testsuite/g++.dg/lookup/scoped6.C
new file mode 100644 (file)
index 0000000..d9566a7
--- /dev/null
@@ -0,0 +1,17 @@
+template <typename X>
+class Foo {
+  int i;
+public:
+  Foo() {
+    X::explode(); // { dg-error "" }
+  }
+};
+
+class Bar {
+  Foo<int> foo_;
+public:
+  Bar() {}  // { dg-error "instantiated" }
+};
+
+template class Foo<int>;
+