This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix 21383
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 18 Oct 2005 14:47:36 +0100
- Subject: [C++ PATCH] Fix 21383
This patch fixes 21383.
a template-id-expr can have a NULL arg vector.
built & tested on i686-pc-linux-gnu.
probably worth backporting to 3.4, as although this test case is invalid, it
would be possible to construct one that is valid.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
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.
Index: cp/name-lookup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.143
diff -c -3 -p -r1.143 name-lookup.c
*** cp/name-lookup.c 27 Sep 2005 23:31:34 -0000 1.143
--- cp/name-lookup.c 18 Oct 2005 13:32:23 -0000
*************** arg_assoc (struct arg_lookup *k, tree n)
*** 4594,4602 ****
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;
}
else if (TREE_CODE (n) == OVERLOAD)
{
--- 4594,4603 ----
return true;
/* Now the arguments. */
! 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)
{
// 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" "" }
}