This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/4232: template instantiation in function body using a template argument fails



>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]