public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/4232: template instantiation in function body using a template argument fails
@ 2001-09-09 12:56 Philip Martin
  0 siblings, 0 replies; 4+ messages in thread
From: Philip Martin @ 2001-09-09 12:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/4232; it has been noted by GNATS.

From: Philip Martin <philip_martin@ntlworld.com>
To: gcc-gnats@gcc.gnu.org, vyzo@media.mit.edu, gcc-bugs@gcc.gnu.org
Cc:  
Subject: Re: c++/4232: template instantiation in function body using a template argument fails
Date: 09 Sep 2001 20:50:45 +0100

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4232&database=gcc
 
 This is not a gcc bug, your code is invalid. Replace
 
    template <typename _type>
    _type moo( const foo& f ) { return f.cast_foo<_type>(); }
 
 with
 
    template <typename _type>
    _type moo( const foo& f ) { return f.template cast_foo<_type>(); }
 
 and your code will compile.
 
 Philip
 
 


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

* Re: c++/4232: template instantiation in function body using a template argument fails
@ 2001-09-14  6:48 lerdsuwa
  0 siblings, 0 replies; 4+ messages in thread
From: lerdsuwa @ 2001-09-14  6:48 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, vyzo

Synopsis: template instantiation in function body using a template argument fails

State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Fri Sep 14 06:48:30 2001
State-Changed-Why:
    Duplicate of PR3012.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4232&database=gcc


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

* Re: c++/4232: template instantiation in function body using a template argument fails
@ 2001-09-09 13:46 Alexandre Oliva
  0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Oliva @ 2001-09-09 13:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/4232; it has been noted by GNATS.

From: Alexandre Oliva <aoliva@redhat.com>
To: Philip Martin <philip_martin@ntlworld.com>
Cc: gcc-gnats@gcc.gnu.org, vyzo@media.mit.edu, gcc-bugs@gcc.gnu.org
Subject: Re: c++/4232: template instantiation in function body using a template argument fails
Date: 09 Sep 2001 17:41:23 -0300

 On Sep  9, 2001, Philip Martin <philip_martin@ntlworld.com> wrote:
 
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4232&database=gcc
 
 > This is not a gcc bug, your code is invalid.
 
 Not really.  The `template' keyword should only be required below in
 case the type of `f' was dependent on template arguments.  But this is
 not the case, so `template' is optional.  Using it is just a
 work-around for GCC.
 
 >    template <typename _type>
 >    _type moo( const foo& f ) { return f.template cast_foo<_type>(); }
 
 -- 
 Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
 Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
 CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
 Free Software Evangelist    *Please* write to mailing lists, not to me
 


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

* c++/4232: template instantiation in function body using a template argument fails
@ 2001-09-04 17:06 vyzo
  0 siblings, 0 replies; 4+ messages in thread
From: vyzo @ 2001-09-04 17:06 UTC (permalink / raw)
  To: gcc-gnats

>Number:         4232
>Category:       c++
>Synopsis:       template instantiation in function body using a template argument fails
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 04 17:06:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Dimitris Vyzovitis
>Release:        gcc-3.0.1
>Organization:
>Environment:
gnu-pc-linux-i686
>Description:
The compiler fails with a parse error if a template function tris to instatiate a template using one of its template parameters as an argument.
>How-To-Repeat:
The following code fails to compile with the following error:
foo.C: In function `_type moo(const foo&)':
foo.C:10: parse error before `>' token

test file: foo.C
----------
struct foo {
	template <typename _type>
	operator _type() const { return _type(); }
	
	template <typename _type>
	_type cast_foo() const { return *this; }
};

template <typename _type>
_type moo( const foo& f ) { return f.cast_foo<_type>(); }

int main() {
	return 0;
}
---------------------
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2001-09-14  6:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-09 12:56 c++/4232: template instantiation in function body using a template argument fails Philip Martin
  -- strict thread matches above, loose matches on Subject: below --
2001-09-14  6:48 lerdsuwa
2001-09-09 13:46 Alexandre Oliva
2001-09-04 17:06 vyzo

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