public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15453] New: Friend declaration not treated as a declaration in scope.
@ 2004-05-15 18:25 igodard at pacbell dot net
  2004-05-15 18:41 ` [Bug c++/15453] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: igodard at pacbell dot net @ 2004-05-15 18:25 UTC (permalink / raw)
  To: gcc-bugs

In the following example:

template<typename G, template<typename H> class I = B>
class J;

template<typename C, template<typename D> class E>
class F {
    template<typename G, template<typename H> class I = B>
    friend
    class J;
    template<typename K, template<typename L> class M = B>
    friend
    class N;
    friend
    class O;

    J<int, B>* j;
    N<int, B>* n;
    O* o;
    };

int main() {
    return 0;
    }

N appears to not be recognized as a template (in the declaration of n) based on its declaration as a template friend, whereas exactly the same declaration with an additional declaration in file scope is acceptable (template class J, declaring j), as is a friend declaration of a plain class. The c++ rules in this area are incomprehensible to me, but admitting friend declarations in one case and not the other seems unreasonable if not incorrect.

Ivan

-- 
           Summary: Friend declaration not treated as a declaration in
                    scope.
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15453


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

* [Bug c++/15453] Friend declaration not treated as a declaration in scope.
  2004-05-15 18:25 [Bug c++/15453] New: Friend declaration not treated as a declaration in scope igodard at pacbell dot net
@ 2004-05-15 18:41 ` pinskia at gcc dot gnu dot org
  2004-05-15 18:42 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-15 18:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-15 03:47 -------
ICC 6.0 accepts this.  I am leaving someone more confidence than I am in C++ standard confirming this 
bug.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
      Known to fail|                            |2.95.3 3.0.4 3.2.3 3.3.3
                   |                            |3.4.0 3.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15453


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

* [Bug c++/15453] Friend declaration not treated as a declaration in scope.
  2004-05-15 18:25 [Bug c++/15453] New: Friend declaration not treated as a declaration in scope igodard at pacbell dot net
  2004-05-15 18:41 ` [Bug c++/15453] " pinskia at gcc dot gnu dot org
@ 2004-05-15 18:42 ` pinskia at gcc dot gnu dot org
  2004-05-15 21:48 ` [Bug c++/15453] Friend declaration " giovannibajo at libero dot it
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-15 18:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-15 03:49 -------
I had forgot to give a little better example (which is the one which works for ICC):
template<typename G, template<typename H> class I>
class J;

template<typename C, template<typename D> class B>
class F {
    template<typename G, template<typename H> class I = B>
    friend
    class J;
    template<typename K, template<typename L> class M = B>
    friend
    class N;
    friend
    class O;

    J<int, B>* j;
    N<int, B>* n;
    O* o;
    };

int main() {
    return 0;
    }

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15453


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

* [Bug c++/15453] Friend declaration treated as a declaration in scope.
  2004-05-15 18:25 [Bug c++/15453] New: Friend declaration not treated as a declaration in scope igodard at pacbell dot net
  2004-05-15 18:41 ` [Bug c++/15453] " pinskia at gcc dot gnu dot org
  2004-05-15 18:42 ` pinskia at gcc dot gnu dot org
@ 2004-05-15 21:48 ` giovannibajo at libero dot it
  2004-05-15 21:57 ` giovannibajo at libero dot it
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: giovannibajo at libero dot it @ 2004-05-15 21:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-05-15 09:46 -------
No, the problem is the opposite. The standard says that a friend declaration 
does not introduce the name into the scope in which it is declared 
([basic.scope]/3). So, if we have a bug here, is that we accept the non-
template case:

---------------------------
class A
{
  friend class O;
  O* o;
};
---------------------------

This should be rejected but it is accepted by GCC. I keep this as the bug 
tracked in this report.

BTW, latest EDG agrees with my interpretation, so either Andrew is using an old 
ICC, or he hasn't activated strict ansi mode.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |giovannibajo at libero dot
                   |                            |it
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-05-15 09:46:30
               date|                            |
            Summary|Friend declaration not      |Friend declaration treated
                   |treated as a declaration in |as a declaration in scope.
                   |scope.                      |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15453


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

* [Bug c++/15453] Friend declaration treated as a declaration in scope.
  2004-05-15 18:25 [Bug c++/15453] New: Friend declaration not treated as a declaration in scope igodard at pacbell dot net
                   ` (2 preceding siblings ...)
  2004-05-15 21:48 ` [Bug c++/15453] Friend declaration " giovannibajo at libero dot it
@ 2004-05-15 21:57 ` giovannibajo at libero dot it
  2004-08-12  0:58 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: giovannibajo at libero dot it @ 2004-05-15 21:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-05-15 09:47 -------
I forgot to say, there might be a duplicate of this somewhere in Bugzilla.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15453


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

* [Bug c++/15453] Friend declaration treated as a declaration in scope.
  2004-05-15 18:25 [Bug c++/15453] New: Friend declaration not treated as a declaration in scope igodard at pacbell dot net
                   ` (3 preceding siblings ...)
  2004-05-15 21:57 ` giovannibajo at libero dot it
@ 2004-08-12  0:58 ` pinskia at gcc dot gnu dot org
  2004-10-13 15:21 ` lerdsuwa at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-12  0:58 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |16995
              nThis|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15453


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

* [Bug c++/15453] Friend declaration treated as a declaration in scope.
  2004-05-15 18:25 [Bug c++/15453] New: Friend declaration not treated as a declaration in scope igodard at pacbell dot net
                   ` (4 preceding siblings ...)
  2004-08-12  0:58 ` pinskia at gcc dot gnu dot org
@ 2004-10-13 15:21 ` lerdsuwa at gcc dot gnu dot org
  2004-12-28 15:30 ` lerdsuwa at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-10-13 15:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-10-13 15:21 -------
Working on friend injection issues.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|lerdsuwa at gcc dot gnu dot |
                   |org                         |
         AssignedTo|unassigned at gcc dot gnu   |lerdsuwa at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
      Known to fail|2.95.3 3.0.4 3.2.3 3.3.3    |2.95.3 3.0.4 3.2.3 3.3.3
                   |3.4.0 4.0                   |3.4.0 4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15453


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

* [Bug c++/15453] Friend declaration treated as a declaration in scope.
  2004-05-15 18:25 [Bug c++/15453] New: Friend declaration not treated as a declaration in scope igodard at pacbell dot net
                   ` (5 preceding siblings ...)
  2004-10-13 15:21 ` lerdsuwa at gcc dot gnu dot org
@ 2004-12-28 15:30 ` lerdsuwa at gcc dot gnu dot org
  2005-05-22 11:44 ` lerdsuwa at gcc dot gnu dot org
  2005-05-22 14:06 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-12-28 15:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-12-28 15:30 -------
The patch for PR1016 will also fix this bug.  That patch is ready 
and the plan is getting it in after GCC 4.0 is branched.  I am
closing this as a duplicate.

*** This bug has been marked as a duplicate of 1016 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15453


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

* [Bug c++/15453] Friend declaration treated as a declaration in scope.
  2004-05-15 18:25 [Bug c++/15453] New: Friend declaration not treated as a declaration in scope igodard at pacbell dot net
                   ` (6 preceding siblings ...)
  2004-12-28 15:30 ` lerdsuwa at gcc dot gnu dot org
@ 2005-05-22 11:44 ` lerdsuwa at gcc dot gnu dot org
  2005-05-22 14:06 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2005-05-22 11:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2005-05-22 11:43 -------
Also fixed in GCC 4.0.1.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15453


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

* [Bug c++/15453] Friend declaration treated as a declaration in scope.
  2004-05-15 18:25 [Bug c++/15453] New: Friend declaration not treated as a declaration in scope igodard at pacbell dot net
                   ` (7 preceding siblings ...)
  2005-05-22 11:44 ` lerdsuwa at gcc dot gnu dot org
@ 2005-05-22 14:06 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-22 14:06 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.0.1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15453


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

end of thread, other threads:[~2005-05-22 14:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-15 18:25 [Bug c++/15453] New: Friend declaration not treated as a declaration in scope igodard at pacbell dot net
2004-05-15 18:41 ` [Bug c++/15453] " pinskia at gcc dot gnu dot org
2004-05-15 18:42 ` pinskia at gcc dot gnu dot org
2004-05-15 21:48 ` [Bug c++/15453] Friend declaration " giovannibajo at libero dot it
2004-05-15 21:57 ` giovannibajo at libero dot it
2004-08-12  0:58 ` pinskia at gcc dot gnu dot org
2004-10-13 15:21 ` lerdsuwa at gcc dot gnu dot org
2004-12-28 15:30 ` lerdsuwa at gcc dot gnu dot org
2005-05-22 11:44 ` lerdsuwa at gcc dot gnu dot org
2005-05-22 14:06 ` pinskia at gcc dot gnu dot org

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