c/5809: Not possible to declare a pointer to function return type
jfranzoy@yahoo.com.ar
jfranzoy@yahoo.com.ar
Fri Mar 1 15:56:00 GMT 2002
>Number: 5809
>Category: c
>Synopsis: Not possible to declare a pointer to function return type
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Fri Mar 01 15:56:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: jfranzoy@yahoo.com.ar
>Release: Reading specs from /usr/local/gcc-3.0.2/lib/gcc-lib/sparc-sun-solaris2.6/3.0.2/specs
>Organization:
>Environment:
uname -a
SunOS ultra5 5.6 Generic_105181-20 sun4u sparc SUNW,Ultra-5_10
>Description:
The compiler raises a "parse error before `)' token" when parsing a function that returns a pointer to function
>How-To-Repeat:
int do_something() { return 0; }
int (*)() problematic_function() { return &do_something; }
>Fix:
Workarounds:
int do_something() { return 0; }
typedef int (*ReturnType)();
ReturnType notProblematicAnymore() {
return &do_something;
}
or if you have a template function and the return type depends upong one of the template parameters:
template<class T>
int do_something(T) { return 0; }
template<class T> class Aux {
public:
typedef int (*ReturnType)(T);
};
template<class Arg1>
Aux<Arg1>::ReturnType notProblematicNeither() {
return &do_something<Arg1>;
}
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-prs
mailing list