public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/24629]  New: Can't use template argument as friend
@ 2005-11-02  1:48 mikel at att dot net
  2005-11-02  1:53 ` [Bug c++/24629] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: mikel at att dot net @ 2005-11-02  1:48 UTC (permalink / raw)
  To: gcc-bugs

Fails on:
  gcc (GCC) 3.3.4 (Mandrakelinux 10.1 3.3.4-2mdk)
  Linux 2.6.8.1-12mdk #1 i686 Athlon XP GNU/Linux

and

  g++ (GCC) 3.4.0
  SunOS 5.9 Generic_112233-12 sun4u sparc SUNW,UltraAX-i2

The following fails to compile:

template<class T>
class Foo {
    // The "friend" declaration below causes fialure with
    // error: using template type parameter `T' after `class'
    friend class T;
};

class Bar {
};

int
main(int, char**)
{
    Foo<Bar> foo;
    return 0;
}


-- 
           Summary: Can't use template argument as friend
           Product: gcc
           Version: 3.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mikel at att dot net


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


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

* [Bug c++/24629] Can't use template argument as friend
  2005-11-02  1:48 [Bug c++/24629] New: Can't use template argument as friend mikel at att dot net
@ 2005-11-02  1:53 ` pinskia at gcc dot gnu dot org
  2005-11-02  9:20 ` giovannibajo at libero dot it
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-02  1:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-11-02 01:53 -------
I don't think this is valid C++ (at least C++98).


-- 


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


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

* [Bug c++/24629] Can't use template argument as friend
  2005-11-02  1:48 [Bug c++/24629] New: Can't use template argument as friend mikel at att dot net
  2005-11-02  1:53 ` [Bug c++/24629] " pinskia at gcc dot gnu dot org
@ 2005-11-02  9:20 ` giovannibajo at libero dot it
  2005-11-03  1:28 ` mikel at att dot net
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: giovannibajo at libero dot it @ 2005-11-02  9:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from giovannibajo at libero dot it  2005-11-02 09:20 -------
Template parameters can't be used in friend declarations (nor in any elaborated
type specifier construct).


-- 

giovannibajo at libero dot it changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug c++/24629] Can't use template argument as friend
  2005-11-02  1:48 [Bug c++/24629] New: Can't use template argument as friend mikel at att dot net
  2005-11-02  1:53 ` [Bug c++/24629] " pinskia at gcc dot gnu dot org
  2005-11-02  9:20 ` giovannibajo at libero dot it
@ 2005-11-03  1:28 ` mikel at att dot net
  2007-01-06  5:28 ` pinskia at gcc dot gnu dot org
  2008-06-22 20:14 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 7+ messages in thread
From: mikel at att dot net @ 2005-11-03  1:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mikel at att dot net  2005-11-03 01:28 -------
Mea Culpa. It was supported by the other compilers I use (MS and Sun), and it
seemed like such an obvious thing to want to do, and I didn't think anyone
would want explicitly to exclude it, so I didn't check the standard. I'm *very*
sorry to have wasted your time. FWIW, I discovered a workaround at
http://www.byte.com/documents/s=9162/cujexp0312wilson2/


-- 


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


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

* [Bug c++/24629] Can't use template argument as friend
  2005-11-02  1:48 [Bug c++/24629] New: Can't use template argument as friend mikel at att dot net
                   ` (2 preceding siblings ...)
  2005-11-03  1:28 ` mikel at att dot net
@ 2007-01-06  5:28 ` pinskia at gcc dot gnu dot org
  2008-06-22 20:14 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-01-06  5:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2007-01-06 05:28 -------
*** Bug 30390 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gzljg at hotmail dot com


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


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

* [Bug c++/24629] Can't use template argument as friend
  2005-11-02  1:48 [Bug c++/24629] New: Can't use template argument as friend mikel at att dot net
                   ` (3 preceding siblings ...)
  2007-01-06  5:28 ` pinskia at gcc dot gnu dot org
@ 2008-06-22 20:14 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-06-22 20:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2008-06-22 20:13 -------
*** Bug 36601 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |igodard at pacbell dot net


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


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

* [Bug c++/24629] Can't use template argument as friend
       [not found] <bug-24629-4@http.gcc.gnu.org/bugzilla/>
@ 2011-02-15  0:13 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-02-15  0:13 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |DUPLICATE

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-02-14 23:07:25 UTC ---
C++0x has changed the rules slightly and allows:
template<class T>
class Foo {
    friend T;
};

But GCC does not implement this new rule yet. See 47721.

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


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

end of thread, other threads:[~2011-02-14 23:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-02  1:48 [Bug c++/24629] New: Can't use template argument as friend mikel at att dot net
2005-11-02  1:53 ` [Bug c++/24629] " pinskia at gcc dot gnu dot org
2005-11-02  9:20 ` giovannibajo at libero dot it
2005-11-03  1:28 ` mikel at att dot net
2007-01-06  5:28 ` pinskia at gcc dot gnu dot org
2008-06-22 20:14 ` pinskia at gcc dot gnu dot org
     [not found] <bug-24629-4@http.gcc.gnu.org/bugzilla/>
2011-02-15  0:13 ` pinskia at gcc dot gnu.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).