re PR c++/21383 (Crash when finding &a_templated_func<>)
authorNathan Sidwell <nathan@codesourcery.com>
Tue, 18 Oct 2005 13:45:23 +0000 (13:45 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Tue, 18 Oct 2005 13:45:23 +0000 (13:45 +0000)
cp:
PR c++/21383
* name-lookup.c (arg_assoc): Template args can be null in a
template-id-expr.
testsuite:
PR c++/21383
* g++.dg/overload/koenig2.C: New.

From-SVN: r105553

gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/overload/koenig2.C [new file with mode: 0644]

index cd3cded707a3a37534d6905f329b31d1576a252e..42dc317095d19eef82ca0dbdcd00317bb6241262 100644 (file)
@@ -1,5 +1,9 @@
 2005-10-18  Nathan Sidwell  <nathan@codesourcery.com>
 
+       PR c++/21383
+       * name-lookup.c (arg_assoc): Template args can be null in a
+       template-id-expr.
+
        PR c++/22604
        * class.c (update_vtable_entry_for_fn): Don't process invalid
        covariant overriders.
index 29e5f2b2be6fbb566372189e7131fb5459783723..13d789b1f5612869d7157d5d72bce96e6ac0f4af 100644 (file)
@@ -4594,9 +4594,10 @@ arg_assoc (struct arg_lookup *k, tree n)
        return true;
 
       /* Now the arguments.  */
-      for (ix = TREE_VEC_LENGTH (args); ix--;)
-       if (arg_assoc_template_arg (k, TREE_VEC_ELT (args, ix)) == 1)
-         return true;
+      if (args)
+       for (ix = TREE_VEC_LENGTH (args); ix--;)
+         if (arg_assoc_template_arg (k, TREE_VEC_ELT (args, ix)) == 1)
+           return true;
     }
   else if (TREE_CODE (n) == OVERLOAD)
     {
index ce6dd03c08272de57426f27e2a72762e72f80da4..54122c1dbababa68fc1bfd7d4ffab4748bf398ee 100644 (file)
@@ -1,5 +1,8 @@
 2005-10-18  Nathan Sidwell  <nathan@codesourcery.com>
 
+       PR c++/21383
+       * g++.dg/overload/koenig2.C: New.
+
        PR c++/23118
        * g++.dg/overload/error2.C: New.
 
diff --git a/gcc/testsuite/g++.dg/overload/koenig2.C b/gcc/testsuite/g++.dg/overload/koenig2.C
new file mode 100644 (file)
index 0000000..f35aa1a
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 18 Oct 2005 <nathan@codesourcery.com>
+
+// PR 21383
+// Origin: Matthew Hall <mahall@ncsa.uiuc.edu>
+
+template <class T>
+void dummy(T& t);
+
+void anyfunc(int x);
+
+void Foo ()
+{
+  anyfunc (&dummy<>); // { dg-error "cannot resolve overload" "" }
+}