public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/8099: Friend classes and template specializations
@ 2002-09-30 10:16 bangerth
  0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2002-09-30 10:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8099
>Category:       c++
>Synopsis:       Friend classes and template specializations
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 30 10:16:13 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang Bangerth
>Release:        unknown-1.0
>Organization:
>Environment:
all gcc versions up to gcc3.2
>Description:
[Note that there are already a number of related bug reports,
at least c++/8056 comes to my mind, but there may be more.]

Maybe this is just some point where the standard is unclear:
in 14.5.3.1, the following example is given of a friend
declaration:
  template <typename T> class X {
    friend class X<int>;
  };
One would presume that this syntax also holds if a class
Y would name a particular (fully specialized) instance of
X as a friend. That would be irrespective of whether this
instance is derived from the general template for X, or
from a partial or full explicit specialization of X. Then
the following example should compile (as it does with
Compaq's cxx and Intel's icc):
--------------------------------
template <int N, typename T> class X;
template <typename T>        class X<1,T>;

template <typename P> class Y {
    static int i;
    template <int N, typename T> friend class X;
    friend class X<1,P>;
};

template <typename T> class X<1,T> {
    X () { Y<T>::i; };     // access private field
};
-------------------------------------

gcc rejects the second friend declaration, apparently
refering to 14.7.3.17, which states that "An  explicit 
specialization declaration shall not be a friend 
declaration".

So I admit I am confused, both about the standard and
the behavior of different compilers. Since gcc behavior
restricts the use of the language (IMHO) unduly, I would
opt for it to follow the other compiler's interpretation.

Regards
  Wolfgang

>How-To-Repeat:

>Fix:

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


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

* Re: c++/8099: Friend classes and template specializations
@ 2002-12-19  7:33 lerdsuwa
  0 siblings, 0 replies; 3+ messages in thread
From: lerdsuwa @ 2002-12-19  7:33 UTC (permalink / raw)
  To: bangerth, gcc-bugs, gcc-prs, lerdsuwa

Synopsis: Friend classes and template specializations

State-Changed-From-To: analyzed->closed
State-Changed-By: lerdsuwa
State-Changed-When: Thu Dec 19 07:33:31 2002
State-Changed-Why:
    Fixed in 3.3 and main trunk.

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


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

* Re: c++/8099: Friend classes and template specializations
@ 2002-12-16  8:26 Kriang Lerdsuwanakij
  0 siblings, 0 replies; 3+ messages in thread
From: Kriang Lerdsuwanakij @ 2002-12-16  8:26 UTC (permalink / raw)
  To: lerdsuwa; +Cc: gcc-prs

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

From: Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, lerdsuwa@gcc.gnu.org,
        bangerth@ticam.utexas.edu, gcc-bugs@gcc.gnu.org
Cc:  
Subject: Re: c++/8099: Friend classes and template specializations
Date: Mon, 16 Dec 2002 23:24:47 +0700

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8099
 
 I have submit a patch that fixes this.  It is waiting for approval:
 
    http://gcc.gnu.org/ml/gcc-patches/2002-11/msg01639.html
 
 --Kriang
 


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

end of thread, other threads:[~2002-12-19 15:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-30 10:16 c++/8099: Friend classes and template specializations bangerth
2002-12-16  8:26 Kriang Lerdsuwanakij
2002-12-19  7:33 lerdsuwa

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