public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/5809: Not possible to declare a pointer to function return type
@ 2002-03-01 15:56 jfranzoy
  0 siblings, 0 replies; 2+ messages in thread
From: jfranzoy @ 2002-03-01 15:56 UTC (permalink / raw)
  To: gcc-gnats; +Cc: jcfranzoy


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: c/5809: Not possible to declare a pointer to function return type
@ 2002-03-02 11:58 nathan
  0 siblings, 0 replies; 2+ messages in thread
From: nathan @ 2002-03-02 11:58 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jcfranzoy, jfranzoy, nobody

Synopsis: Not possible to declare a pointer to function return type

State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Sat Mar  2 11:58:07 2002
State-Changed-Why:
    you mean
    int f ();
    
    int (*func ()) () 
    {
      return f;
    }
    

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5809


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-03-02 19:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-01 15:56 c/5809: Not possible to declare a pointer to function return type jfranzoy
2002-03-02 11:58 nathan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).