This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/5809: Not possible to declare a pointer to function return type
- From: jfranzoy at yahoo dot com dot ar
- To: gcc-gnats at gcc dot gnu dot org
- Cc: jcfranzoy at ats dot com dot ar
- Date: 1 Mar 2002 23:50:16 -0000
- Subject: c/5809: Not possible to declare a pointer to function return type
- Reply-to: jfranzoy at yahoo dot com dot ar
>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: