public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* How to explain this syntax?
@ 2023-04-16 10:25 Andy
  2023-04-16 10:53 ` Andrew Haley
  2023-04-19 11:40 ` Andy
  0 siblings, 2 replies; 6+ messages in thread
From: Andy @ 2023-04-16 10:25 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 700 bytes --]

In gcc/gcc/testsuite/gcc.c-torture/compile/pr43635.c
we have

extern void d (void);

void (*foo (void)) (float)
{
  void (*(*x) (void)) (float) = d;
  return (*x) ();
}

d is a function without parameters and nothing returns.
foo is function without parameters and returns pointer to function with one
parameter float and also returning void?
what is type of x?
void (*(*x) (void)) (float) is on whole type definition of x or part is
type definition of x and part is cast d to x? which parts?
why not returns x but (*x) ()? don' t return pointer to function but call
this function?
I know, this is malignant example, in in real world can't be cast function
returning void to function returning value

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

end of thread, other threads:[~2023-04-19 12:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-16 10:25 How to explain this syntax? Andy
2023-04-16 10:53 ` Andrew Haley
2023-04-19 11:40 ` Andy
2023-04-19 11:53   ` Xi Ruoyao
2023-04-19 12:35     ` Andy
2023-04-19 12:41       ` Xi Ruoyao

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).