mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-21 14:41:07 +08:00
re PR c++/27714 (operator new as friend in template class rejected)
PR c++/27714 * pt.c (push_template_decl_real): A friend template with class scope isn't primary. From-SVN: r116379
This commit is contained in:
parent
cd051390eb
commit
c9cbfca6f5
@ -1,4 +1,10 @@
|
||||
2006-08-11 Benjamin Smedberg <benjamin@smedbergs.us>
|
||||
2006-08-23 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/27714
|
||||
* pt.c (push_template_decl_real): A friend template with class
|
||||
scope isn't primary.
|
||||
|
||||
2006-08-23 Benjamin Smedberg <benjamin@smedbergs.us>
|
||||
|
||||
PR c++/28687
|
||||
* rtti.c (build_dynamic_cast, build_dynamic_cast_1):
|
||||
|
@ -3022,7 +3022,13 @@ push_template_decl_real (tree decl, bool is_friend)
|
||||
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
|
||||
|
||||
/* See if this is a primary template. */
|
||||
primary = template_parm_scope_p ();
|
||||
if (is_friend && ctx)
|
||||
/* A friend template that specifies a class context, i.e.
|
||||
template <typename T> friend void A<T>::f();
|
||||
is not primary. */
|
||||
primary = 0;
|
||||
else
|
||||
primary = template_parm_scope_p ();
|
||||
|
||||
if (primary)
|
||||
{
|
||||
|
9
gcc/testsuite/g++.dg/template/friend46.C
Normal file
9
gcc/testsuite/g++.dg/template/friend46.C
Normal file
@ -0,0 +1,9 @@
|
||||
// PR c++/27714
|
||||
|
||||
template<typename> struct A
|
||||
{
|
||||
static void* operator new(__SIZE_TYPE__);
|
||||
template <typename T> friend void* A<T>::operator new(__SIZE_TYPE__);
|
||||
};
|
||||
|
||||
A<int> a;
|
Loading…
x
Reference in New Issue
Block a user