public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9979: Lookup of friend function template in another namespace fails
@ 2003-03-06 14:12 lerdsuwa
  0 siblings, 0 replies; 3+ messages in thread
From: lerdsuwa @ 2003-03-06 14:12 UTC (permalink / raw)
  To: Nicola.Musatti, gcc-bugs, gcc-prs, nobody

Synopsis: Lookup of friend function template in another namespace fails

State-Changed-From-To: open->analyzed
State-Changed-By: lerdsuwa
State-Changed-When: Thu Mar  6 14:12:19 2003
State-Changed-Why:
    Confirmed.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9979


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: c++/9979: Lookup of friend function template in another namespace fails
@ 2003-03-06 14:20 bangerth
  0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2003-03-06 14:20 UTC (permalink / raw)
  To: Nicola.Musatti, gcc-bugs, gcc-prs, nobody

Synopsis: Lookup of friend function template in another namespace fails

State-Changed-From-To: analyzed->closed
State-Changed-By: bangerth
State-Changed-When: Thu Mar  6 14:20:45 2003
State-Changed-Why:
    This is actually a duplicate of 8355 which gives a rather
    thourough outline of all the problems in this area

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9979


^ permalink raw reply	[flat|nested] 3+ messages in thread

* c++/9979: Lookup of friend function template in another namespace fails
@ 2003-03-06  9:56 Nicola.Musatti
  0 siblings, 0 replies; 3+ messages in thread
From: Nicola.Musatti @ 2003-03-06  9:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9979
>Category:       c++
>Synopsis:       Lookup of friend function template in another namespace fails
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 06 09:56:04 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Nicola.Musatti@ObjectWay.it
>Release:        gcc version 3.2 (mingw special 20020817-1)
>Organization:
>Environment:
Reading specs from d:/opt/mingw/bin/../lib/gcc-lib/mingw32/3.2/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=
mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable
-languages=f77,c++,objc,ada --disable-win32-registry --disable-shared
Thread model: win32
gcc version 3.2 (mingw special 20020817-1)
>Description:
A valid friend declaration of a function template from a different namespce results in the following error message:

friend.cpp:12: `void A::f(B::C*)' should have been declared inside `A'

This appears to be a known problem (it is described here: http://www.cuj.com/experts/2101/sutter.htm), but I couldn't find a specific bug report.
>How-To-Repeat:
Save the following program in file 'friend.cpp':

namespace A
{
template <typename T> void f(T * t) { delete t; } 
}

namespace B
{
class C
{
  private:
    friend void A::f<>(C *);

    ~C() {}
};
}

int main()
{
  B::C * c = new B::C;
  A::f(c);
}

Compile with g++ friend.cpp.
>Fix:
I tried some alternative syntaxes (e.g. by explicitly providing the friend function template argument) without success. The only workaround is to make the required members public.
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-03-06 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-06 14:12 c++/9979: Lookup of friend function template in another namespace fails lerdsuwa
  -- strict thread matches above, loose matches on Subject: below --
2003-03-06 14:20 bangerth
2003-03-06  9:56 Nicola.Musatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).