public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9230: Friend definitions in template classes
@ 2003-04-29 20:03 bangerth
  0 siblings, 0 replies; 9+ messages in thread
From: bangerth @ 2003-04-29 20:03 UTC (permalink / raw)
  To: bangerth, gcc-bugs, gcc-prs, nobody

Synopsis: Friend definitions in template classes

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Tue Apr 29 20:03:24 2003
State-Changed-Why:
    We didn't reach a conclusion, but at least it is analyzed.

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


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

* Re: c++/9230: Friend definitions in template classes
@ 2003-01-08 19:37 bangerth
  0 siblings, 0 replies; 9+ messages in thread
From: bangerth @ 2003-01-08 19:37 UTC (permalink / raw)
  To: bangerth, gcc-bugs, gcc-prs, nobody

Synopsis: Friend definitions in template classes

State-Changed-From-To: closed->open
State-Changed-By: bangerth
State-Changed-When: Wed Jan  8 11:37:03 2003
State-Changed-Why:
    Seems like I lost my opinion. Gaby wants us to keep this
    open, so let's do it.

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


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

* Re: c++/9230: Friend definitions in template classes
@ 2003-01-08 19:16 Gabriel Dos Reis
  0 siblings, 0 replies; 9+ messages in thread
From: Gabriel Dos Reis @ 2003-01-08 19:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9230; it has been noted by GNATS.

From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: reichelt@igpm.rwth-aachen.de
Cc: bangerth@ticam.utexas.edu, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Subject: Re: c++/9230: Friend definitions in template classes
Date: 08 Jan 2003 20:07:15 +0100

 reichelt@igpm.rwth-aachen.de writes:
 
 | Synopsis: Friend definitions in template classes
 | 
 | State-Changed-From-To: open->feedback
 | State-Changed-By: reichelt
 | State-Changed-When: Wed Jan  8 09:14:33 2003
 | State-Changed-Why:
 |     As I read paragraph 14.6.5.1 in the standard, this is the expected behavior:
 |     
 |     > Friend classes or functions can be declared within a class template. When
 |     > a template is instantiated, the names of its friends are treated as if
 |     > the specialization had been explicitly declared at its point of instantiation.
 
 Declared *where*?
 
 
 |     Convinced, Wolfgang?
 
 I'm not Wolfgang but I'm not convinced.  Read on 14.6.5/2:
 
   As with non-template classes, the names of namespace-scope friend
   functions of a class template special-ization are not visible during
   an ordinary lookup unless explicitly declared at namespace scope
   (11.4). Such names may be found under the rules for associated
   classes (3.4.2).
 
 -- Gaby


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

* Re: c++/9230: Friend definitions in template classes
@ 2003-01-08 19:16 Gabriel Dos Reis
  0 siblings, 0 replies; 9+ messages in thread
From: Gabriel Dos Reis @ 2003-01-08 19:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9230; it has been noted by GNATS.

From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Cc: reichelt@igpm.rwth-aachen.de, <gcc-bugs@gcc.gnu.org>,
   <gcc-prs@gcc.gnu.org>, <nobody@gcc.gnu.org>, <gcc-gnats@gcc.gnu.org>
Subject: Re: c++/9230: Friend definitions in template classes
Date: 08 Jan 2003 20:09:28 +0100

 Wolfgang Bangerth <bangerth@ticam.utexas.edu> writes:
 
 | >     As I read paragraph 14.6.5.1 in the standard, this is the expected behavior:
 | >     
 | >     > Friend classes or functions can be declared within a class template. When
 | >     > a template is instantiated, the names of its friends are treated as if
 | >     > the specialization had been explicitly declared at its point of instantiation.
 | 
 | That leaves no wishes for clarity unheard.
 
 I disagree:  That doesn't say where the declaration appears.
 
 [...]
 
 | Yes :-) I just did not know where to look exactly. Do you want to close 
 | it or should I do that?
 
 Please, don't close this until we solve this as a non-issue.
 
 -- Gaby


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

* Re: c++/9230: Friend definitions in template classes
@ 2003-01-08 19:06 Gabriel Dos Reis
  0 siblings, 0 replies; 9+ messages in thread
From: Gabriel Dos Reis @ 2003-01-08 19:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9230; it has been noted by GNATS.

From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: bangerth@ticam.utexas.edu
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/9230: Friend definitions in template classes
Date: 08 Jan 2003 20:01:57 +0100

 bangerth@ticam.utexas.edu writes:
 
 | I'm not sure about this one:
 | --------------------------
 | template <class T> class X {
 |     friend void f () {};
 | };
 | 
 | void g() { f(); }
 | --------------------------
 | This yields:
 | h.cc: In function `void g()':
 | h.cc:5: error: `f' undeclared (first use this function)
 | h.cc:5: error: (Each undeclared identifier is reported only once for each
 |    function it appears in.)
 | 
 | On the other hand, this compiles cleanly:
 | --------------------------
 | template <class T> class X {
 |     friend void f () {};
 | };
 | 
 | template class X<int>;
 | void g() { f(); }
 
 This  is a bogus behaviour of g++ I came across from time to time.
 More generally, we have BIG problems in the current name-lookup
 implementation.
 
 | In other words, the function f() is injected into the global
 | namespace only upon the first instantiation of the template
 | class X. Is this the way it is supposed to be?
 
 No.
 
 There is no declaration of f() in the global scope.
 
 -- Gaby


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

* Re: c++/9230: Friend definitions in template classes
@ 2003-01-08 17:26 Wolfgang Bangerth
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Bangerth @ 2003-01-08 17:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9230; it has been noted by GNATS.

From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: reichelt@igpm.rwth-aachen.de, <bangerth@ticam.utexas.edu>,
   <gcc-bugs@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>, <nobody@gcc.gnu.org>,
   <gcc-gnats@gcc.gnu.org>
Cc:  
Subject: Re: c++/9230: Friend definitions in template classes
Date: Wed, 8 Jan 2003 11:20:21 -0600 (CST)

 >     As I read paragraph 14.6.5.1 in the standard, this is the expected behavior:
 >     
 >     > Friend classes or functions can be declared within a class template. When
 >     > a template is instantiated, the names of its friends are treated as if
 >     > the specialization had been explicitly declared at its point of instantiation.
 
 That leaves no wishes for clarity unheard.
 
 >     Convinced, Wolfgang?
 
 Yes :-) I just did not know where to look exactly. Do you want to close 
 it or should I do that?
 
 W.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth             email:            bangerth@ticam.utexas.edu
                               www: http://www.ticam.utexas.edu/~bangerth/
 
 


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

* Re: c++/9230: Friend definitions in template classes
@ 2003-01-08 17:25 reichelt
  0 siblings, 0 replies; 9+ messages in thread
From: reichelt @ 2003-01-08 17:25 UTC (permalink / raw)
  To: bangerth, gcc-bugs, gcc-prs, nobody

Synopsis: Friend definitions in template classes

State-Changed-From-To: feedback->closed
State-Changed-By: reichelt
State-Changed-When: Wed Jan  8 09:25:48 2003
State-Changed-Why:
    Not a bug.
    Submitter is also convinced ;-)

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


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

* Re: c++/9230: Friend definitions in template classes
@ 2003-01-08 17:14 reichelt
  0 siblings, 0 replies; 9+ messages in thread
From: reichelt @ 2003-01-08 17:14 UTC (permalink / raw)
  To: bangerth, gcc-bugs, gcc-prs, nobody

Synopsis: Friend definitions in template classes

State-Changed-From-To: open->feedback
State-Changed-By: reichelt
State-Changed-When: Wed Jan  8 09:14:33 2003
State-Changed-Why:
    As I read paragraph 14.6.5.1 in the standard, this is the expected behavior:
    
    > Friend classes or functions can be declared within a class template. When
    > a template is instantiated, the names of its friends are treated as if
    > the specialization had been explicitly declared at its point of instantiation.
    
    For short: No instatiation, no declaration.
    
    Convinced, Wolfgang?

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


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

* c++/9230: Friend definitions in template classes
@ 2003-01-08 16:46 bangerth
  0 siblings, 0 replies; 9+ messages in thread
From: bangerth @ 2003-01-08 16:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9230
>Category:       c++
>Synopsis:       Friend definitions in template classes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 08 08:46:07 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang Bangerth
>Release:        unknown-1.0
>Organization:
>Environment:
all versions of gcc
>Description:
I'm not sure about this one:
--------------------------
template <class T> class X {
    friend void f () {};
};

void g() { f(); }
--------------------------
This yields:
h.cc: In function `void g()':
h.cc:5: error: `f' undeclared (first use this function)
h.cc:5: error: (Each undeclared identifier is reported only once for each
   function it appears in.)

On the other hand, this compiles cleanly:
--------------------------
template <class T> class X {
    friend void f () {};
};

template class X<int>;
void g() { f(); }
--------------------------

In other words, the function f() is injected into the global
namespace only upon the first instantiation of the template
class X. Is this the way it is supposed to be?

W.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

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

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-29 20:03 c++/9230: Friend definitions in template classes bangerth
  -- strict thread matches above, loose matches on Subject: below --
2003-01-08 19:37 bangerth
2003-01-08 19:16 Gabriel Dos Reis
2003-01-08 19:16 Gabriel Dos Reis
2003-01-08 19:06 Gabriel Dos Reis
2003-01-08 17:26 Wolfgang Bangerth
2003-01-08 17:25 reichelt
2003-01-08 17:14 reichelt
2003-01-08 16:46 bangerth

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).