public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9783: Can't forward reference class in argument to templated method.
@ 2003-02-20 23:57 bangerth
0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2003-02-20 23:57 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, mleone, nobody
Synopsis: Can't forward reference class in argument to templated method.
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Thu Feb 20 23:57:45 2003
State-Changed-Why:
Confirmed. Here's a simpler testcase:
--------------------------
template <typename T>
struct C {
void foo (struct X *);
};
struct X {};
template <typename T>
void C<T>::foo(struct X *) {}
-------------------------------
It's rejected by all versions of gcc. However, if
one makes C a non-template, then it is accepted. Strange.
I suspect that the language actually mandates this behavior,
since both icc and cxx (well, both EDG based after all)
have this behavior as well. I don't know what is right in
this case.
W.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9783
^ permalink raw reply [flat|nested] 2+ messages in thread
* c++/9783: Can't forward reference class in argument to templated method.
@ 2003-02-20 23:26 mleone
0 siblings, 0 replies; 2+ messages in thread
From: mleone @ 2003-02-20 23:26 UTC (permalink / raw)
To: gcc-gnats
>Number: 9783
>Category: c++
>Synopsis: Can't forward reference class in argument to templated method.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Thu Feb 20 23:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Mark Leone
>Release: g++ 3.2
>Organization:
>Environment:
RedHat 7.2, i686 multiprocessor
>Description:
The following fails to compile. Workaround is to declare forward reference to class outside the template.
template<class Info>
class Table {
public:
bool Lookup(int name, class Detail* detail, Info* info) const;
void Insert(int name, class Detail* detail, Info info);
};
class Detail {
public:
int stuff;
};
template<class Info>
bool Table<Info>::Lookup(int name, Detail* detail, Info* info) const {
return true;
}
template<class Info>
void Table<Info>::Insert(int name, Detail* detail, Info info) {
}
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-02-20 23:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-20 23:57 c++/9783: Can't forward reference class in argument to templated method bangerth
-- strict thread matches above, loose matches on Subject: below --
2003-02-20 23:26 mleone
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).