This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix bug 5125
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: mark at codesourcery dot com
- Date: Sat, 29 Dec 2001 17:14:43 +0000
- Subject: [C++ PATCH] Fix bug 5125
- Organization: Codesourcery LLC
Hi,
I've installed this obvious patch for bug 5125. We ICEd on a typo'd typename
in a template function declaration. Due to the grammar ambiguity we parse
'TYPO & o' as an expression, and then get confused.
built & tested on i686-pc-linux-gnu.
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2001-12-29 Nathan Sidwell <nathan@codesourcery.com>
PR c++/5125
* pt.c (push_template_decl_real): Make sure DECL has
DECL_LANG_SPECIFIC.
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.566
diff -c -3 -p -r1.566 pt.c
*** pt.c 2001/12/18 14:13:44 1.566
--- pt.c 2001/12/29 15:53:23
*************** push_template_decl_real (decl, is_friend
*** 2627,2633 ****
return decl;
}
}
! else if (! DECL_TEMPLATE_INFO (decl))
{
error ("template definition of non-template `%#D'", decl);
return decl;
--- 2627,2633 ----
return decl;
}
}
! else if (!DECL_LANG_SPECIFIC (decl) || !DECL_TEMPLATE_INFO (decl))
{
error ("template definition of non-template `%#D'", decl);
return decl;
// { dg-do compile }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Dec 2001 <nathan@nathan@codesourcery.com>
// PR 5125. ICE
class S
{
public:
template <class I> void Foo(int (*f)(S& o) ); // { dg-error "candidate" "" }
};
template <class I>
void S::Foo(int (*f)(TYPO&o) )
{ // { dg-error "template definition of non-template|prototype" "" }
}