public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21601] New: Friend of template argument constructor
@ 2005-05-16  1:33 charles dot gretton at gmail dot com
  2005-05-16  1:37 ` [Bug c++/21601] " charles dot gretton at gmail dot com
  2005-05-17 16:45 ` bangerth at dealii dot org
  0 siblings, 2 replies; 3+ messages in thread
From: charles dot gretton at gmail dot com @ 2005-05-16  1:33 UTC (permalink / raw)
  To: gcc-bugs

If we try and make \class{A} inherit from \class{B<A>} which is
friends with A's constructor, the compiler segfaults.

template<typename T>
class B
{
public:
    friend T::T(B&);

//     void some()
//     {
//         T t = T::T(*this);
//     }
    
};

class A : public B<A>
{
public:
    A(B<A>& b);
};


A::A(B<A>& b)
    :B<A>(b)
{
}

-- 
           Summary: Friend of template argument constructor
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: charles dot gretton at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/21601] Friend of template argument constructor
  2005-05-16  1:33 [Bug c++/21601] New: Friend of template argument constructor charles dot gretton at gmail dot com
@ 2005-05-16  1:37 ` charles dot gretton at gmail dot com
  2005-05-17 16:45 ` bangerth at dealii dot org
  1 sibling, 0 replies; 3+ messages in thread
From: charles dot gretton at gmail dot com @ 2005-05-16  1:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From charles dot gretton at gmail dot com  2005-05-16 01:37 -------
Should report:

src_file_name:9: error: template parameters cannot be friends

-- 


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


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

* [Bug c++/21601] Friend of template argument constructor
  2005-05-16  1:33 [Bug c++/21601] New: Friend of template argument constructor charles dot gretton at gmail dot com
  2005-05-16  1:37 ` [Bug c++/21601] " charles dot gretton at gmail dot com
@ 2005-05-17 16:45 ` bangerth at dealii dot org
  1 sibling, 0 replies; 3+ messages in thread
From: bangerth at dealii dot org @ 2005-05-17 16:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2005-05-17 16:41 -------
This is already fixed in gcc4.0 which says 
 
g/x> /home/bangerth/bin/gcc-4*/bin/c++ -c x.cc 
x.cc:5: error: ISO C++ forbids declaration of &#8216;T&#8217; with no type 
x.cc: In instantiation of &#8216;B<A>&#8217;: 
x.cc:14:   instantiated from here 
x.cc:5: error: invalid use of undefined type &#8216;class A&#8217; 
x.cc:14: error: forward declaration of &#8216;class A&#8217; 
 
  
W.  

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|                            |ice-on-invalid-code
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.0


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


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

end of thread, other threads:[~2005-05-17 16:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-16  1:33 [Bug c++/21601] New: Friend of template argument constructor charles dot gretton at gmail dot com
2005-05-16  1:37 ` [Bug c++/21601] " charles dot gretton at gmail dot com
2005-05-17 16:45 ` bangerth at dealii 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).