This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/4232: template instantiation in function body using a template argument fails
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/4232: template instantiation in function body using a template argument fails
- From: vyzo at media dot mit dot edu
- Date: 5 Sep 2001 00:02:50 -0000
- Reply-To: vyzo at media dot mit dot edu
>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: