This is the mail archive of the gcc-prs@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]
Other format: [Raw text]

c/10455: typeof(fn) can be used to declare a variable of type function


>Number:         10455
>Category:       c
>Synopsis:       typeof(fn) can be used to declare a variable of type function
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 22 17:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     dgay at acm dot org
>Release:        avr-gcc-3.3
>Organization:
>Environment:
Linux 2.4.9-13 #1 Tue Oct 30 20:11:04 EST 2001 i686 unknown
>Description:
  void g(void) { }
  typeof(g) x;

can be used to declare a variable of type function, that can be subsequently called (calls the address of the variable, not its content...)

Note that presumably
  typeof(g) *y;
should be accepted...
>How-To-Repeat:
Compile the following source with -S:

void g(void) { }

typeof(g) x;

void f(void) {
  x();
}
>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]