]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/11704 (ICE in type_dependent_expression_p with wrong method call in templat...
authorNathan Sidwell <nathan@codesourcery.com>
Sun, 3 Aug 2003 14:23:34 +0000 (14:23 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Sun, 3 Aug 2003 14:23:34 +0000 (14:23 +0000)
cp:
PR c++/11704
* pt.c (type_dependent_expression_p): Cope with COMPONENT_REF with
unknown type.
testsuite:
PR c++/11704
* g++.dg/template/dependent-expr2.C: New test.

From-SVN: r70119

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/dependent-expr2.C [new file with mode: 0644]

index de0923a96cf14b4bcfb8095932b7837a3f9877a8..a8c8a97b1c5e7e77b227e911827a2eefde77d316 100644 (file)
@@ -1,3 +1,13 @@
+2003-08-03  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR c++/11704
+       * pt.c (type_dependent_expression_p): Cope with COMPONENT_REF with
+       unknown type.
+
+       PR c++/11766
+       * typeck.c (comp_ptr_ttypes_real): Don't loop on pointers to
+       member functions.
+
 2003-08-02  Nathan Sidwell  <nathan@codesourcery.com>
 
        PR c++/9447
index 185a203c20024cd29d067cb10d2ec8103e972b04..706691c6b6a4d19b7fec60659fcccac8c7e82713 100644 (file)
@@ -11625,6 +11625,15 @@ type_dependent_expression_p (tree expression)
     {
       if (TREE_CODE (expression) == ADDR_EXPR)
        return type_dependent_expression_p (TREE_OPERAND (expression, 0));
+      if (TREE_CODE (expression) == COMPONENT_REF)
+       {
+         if (type_dependent_expression_p (TREE_OPERAND (expression, 0)))
+           return true;
+         expression = TREE_OPERAND (expression, 1);
+         if (TREE_CODE (expression) == IDENTIFIER_NODE)
+           return false;
+       }
+      
       if (TREE_CODE (expression) == BASELINK)
        expression = BASELINK_FUNCTIONS (expression);
       if (TREE_CODE (expression) == TEMPLATE_ID_EXPR)
index 61d9742f90dc6b16dd9361715fd050b9c8c64dbc..04c94a293e7f0f9b84dc70098ed1f3a54b6e3340 100644 (file)
@@ -1,5 +1,8 @@
 2003-08-03  Nathan Sidwell  <nathan@codesourcery.com>
 
+       PR c++/11704
+       * g++.dg/template/dependent-expr2.C: New test.
+
        PR c++/11766
        * g++.dg/expr/ptrmem1.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/template/dependent-expr2.C b/gcc/testsuite/g++.dg/template/dependent-expr2.C
new file mode 100644 (file)
index 0000000..9c9d5f9
--- /dev/null
@@ -0,0 +1,23 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 2 Aug 2003 <nathan@codesourcery.com>
+
+// PR 11704. ICE
+
+struct A 
+{
+  int foo() 
+  {
+    return 5;
+  }
+};
+
+template <class T> // If B is not template it works
+struct B
+{
+  bool bar(A& a)
+  {
+    return a.foo == 0; // { dg-error "insufficient context" "" }
+  }
+};