c++/8854: cannot use static template member as a callback

yiu04646@nifty.com yiu04646@nifty.com
Fri Dec 6 18:26:00 GMT 2002


>Number:         8854
>Category:       c++
>Synopsis:       cannot use static template member as a callback
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 06 18:26:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Norihiro Kakihara
>Release:        gcc version 2.95.3-5 (cygwin special)
>Organization:
>Environment:
cygwin 1.3.12-4 (on Microsoft Windows Me)
>Description:
x.cpp: In method `int (* X::bar())()':
x.cpp:7: Internal compiler error.
x.cpp:7: Please submit a full bug report.
x.cpp:7: See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Both static non-templated member, templated function
can be a callback, but their combination cannot.
>How-To-Repeat:
class X {
	template< int N >
	static int foo( ) { return N; }
public:
	typedef int (*Function)( );
	Function bar( ) {
		return foo< 5 >;
	}
};

int main( ) {
	X x;
	x.bar( )( );
	return 0;
}
>Fix:

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



More information about the Gcc-bugs mailing list