public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Jason Mancini" <jayrusman@hotmail.com>
To: gcc@gcc.gnu.org
Cc: shelly@interrasystems.com
Subject: RE: gcc template error?
Date: Wed, 22 Jun 2005 19:31:00 -0000	[thread overview]
Message-ID: <BAY101-F2686248FDE8874CF2E1FA0ABEB0@phx.gbl> (raw)

I suspect this line is the source of your problems:
   friend T<class Y>* func<Y, X>(T<X>* p);
Y isn't a template parameter here, but a (concrete?) class named "Y".
The below compiles with 3.4.3 anyways...
Regards,
-Jason


// Line 1
class A {
public:
   A() { };
   ~A() { };
};


class B {
public:
   B();
   B(const A& a) { };
   ~B();
};


template <typename X, typename Y> class T;

template <typename X, typename Y>
T<X,Y>* func(T<X,Y>* p);


template <typename X, typename Y> class T {
   X*    m_;
public:
   T(X* x) : m_(x) { };
   ~T() { };
   friend T<X,Y>* func<X,Y>(T<X,Y>* p);
};


template <typename X, typename Y>
T<X,Y>* func(T<X,Y>* p) {
   return (new T<X,Y>(new X(*p->m_)));
}


int main() {
   A* a = new A();
   T<A,B>*    p = new T<A,B>(a);
   T<A,B>*    q = func<A, B>(p);
   return 0;
}


             reply	other threads:[~2005-06-22 19:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-22 19:31 Jason Mancini [this message]
2005-06-22 19:41 ` Shelly Adhikari
  -- strict thread matches above, loose matches on Subject: below --
2005-06-22 17:58 Shelly Adhikari
2005-06-22 18:14 ` Andrew Pinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BAY101-F2686248FDE8874CF2E1FA0ABEB0@phx.gbl \
    --to=jayrusman@hotmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=shelly@interrasystems.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).