[cfe-dev] Function pointer variables

Filipe Cabecinhas filcab at gmail.com
Sat Jun 28 12:50:03 PDT 2008


clang blows up with the following program:
void (*f)(void);
void (*f)() = 0;

But gcc compiles happily. Also, in the draft for the standard ( http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf 
  ), it is said that (section 6.9.1 - Function definitions):

typedef int F(void); //type F is ‘‘function with no parameters
                       // returning int’’
// ...
int g() { /* ... */ } //RIGHT: g has type compatible with F

So I'm assuming it's a bug in clang.

Also, is there a way to make clang just blow up when there's an error  
like this so one can see easilly where it blew up and inspect the  
code? (I'm aware that often it is not there that the mistake is, but  
it's a starting point)

Keep up the good work :-)

  - Filipe Cabecinhas

More information about the cfe-dev mailing list