]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/19004 (ICE in uses_template_parms at cp/pt.c:4860)
authorMark Mitchell <mark@codesourcery.com>
Fri, 26 Aug 2005 19:35:13 +0000 (19:35 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 26 Aug 2005 19:35:13 +0000 (19:35 +0000)
PR c++/19004
* pt.c (uses_template_parms): Handle IDENTIFIER_NODE.
(type_dependent_expression_p): Allow BASELINKs whose associated
functions are simply a FUNCTION_DECL.

PR c++/19004
* g++.dg/template/nontype13.C: New test.

From-SVN: r103531

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

index 485cccd22e0fe79cfc95937171fe5dcb126d1edb..4c2c72ed066bece036ce938a514084d03c6607d6 100644 (file)
@@ -1,5 +1,10 @@
 2005-08-26  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/19004
+       * pt.c (uses_template_parms): Handle IDENTIFIER_NODE.
+       (type_dependent_expression_p): Allow BASELINKs whose associated
+       functions are simply a FUNCTION_DECL.
+
        PR c++/23491
        * cp-tree.h (build_vec_init): Adjust prototype.
        * init.c (perform_member_init): Adjust call to build_vec_init.
@@ -9,11 +14,6 @@
        default initialization of vector elements when set.
        * typeck.c (build_modify_expr): Adjust call to build_vec_init.
 
-       PR c++/19004
-       * pt.c (uses_template_parms): Handle IDENTIFIER_NODE.
-       (type_dependent_expression_p): Allow BASELINKs whose associated
-       functions are simply a FUNCTION_DECL.
-
 2005-08-25  Nathan Sidwell  <nathan@codesourcery.com>
 
        PR c++/20817
index 71ac318919350d4c9547b2b52d536af146478728..386dc2ff0d71b5f03630b1450eb70a9633e06e57 100644 (file)
@@ -4956,6 +4956,7 @@ uses_template_parms (tree t)
           || TREE_CODE (t) == TEMPLATE_PARM_INDEX
           || TREE_CODE (t) == OVERLOAD
           || TREE_CODE (t) == BASELINK
+          || TREE_CODE (t) == IDENTIFIER_NODE
           || CONSTANT_CLASS_P (t))
     dependent_p = (type_dependent_expression_p (t)
                   || value_dependent_expression_p (t));
@@ -12356,7 +12357,8 @@ type_dependent_expression_p (tree expression)
            return true;
          expression = TREE_OPERAND (expression, 0);
        }
-      gcc_assert (TREE_CODE (expression) == OVERLOAD);
+      gcc_assert (TREE_CODE (expression) == OVERLOAD
+                 || TREE_CODE (expression) == FUNCTION_DECL);
 
       while (expression)
        {
index cb31b6aeca154e42f4ef76fe8a9243cf3a4c88ff..24179e1c3aaf0f54b6a038e41d92d6fe3fe8cb46 100644 (file)
@@ -1,5 +1,8 @@
 2005-08-26  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/19004
+       * g++.dg/template/nontype13.C: New test.
+       
        PR c++/23491
        * g++.dg/init/new14.C: New test.
        * g++.dg/expr/anew1.C: Do not XFAIL.
diff --git a/gcc/testsuite/g++.dg/template/nontype13.C b/gcc/testsuite/g++.dg/template/nontype13.C
new file mode 100644 (file)
index 0000000..5ff697a
--- /dev/null
@@ -0,0 +1,29 @@
+// PR c++/19004
+
+template<typename T>
+struct Dummy
+{
+  void evil()
+  {
+    this->template tester<true>();
+  }
+      
+  template<bool B>
+  void tester()
+  {
+    bar<evil>()(); // { dg-error "argument" }
+  }
+  template<bool B>
+  struct bar
+  {
+    void operator()()
+    { }
+  };
+};
+
+int main()
+{
+  Dummy<int> d;
+  d.tester<true> (); // { dg-error "instantiated" }
+}
+