Thread overview
bug (static function pointer) ?
Jul 24, 2002
Dario
Jul 24, 2002
anderson
Jul 24, 2002
Pavel Minayev
July 24, 2002
int main()
{
    static void (*fp)() = &func;
    fp();
    return 0;
}
void func() {}

This will crash the compiler (v. 0.35).
Is this a known bug? Isn't this code correct?


July 24, 2002
Defiantly a complier bug. I tested the same code. Anyhow, is static talking about the function pointer or the type of function (ie static function)?

"Dario" <supdar@yahoo.com> wrote in message news:ahls95$29b1$1@digitaldaemon.com...
> int main()
> {
>     static void (*fp)() = &func;
>     fp();
>     return 0;
> }
> void func() {}
>
> This will crash the compiler (v. 0.35).
> Is this a known bug? Isn't this code correct?
>
>


July 24, 2002
On Wed, 24 Jul 2002 11:41:05 +0200 "Dario" <supdar@yahoo.com> wrote:

> int main()
> {
>     static void (*fp)() = &func;
>     fp();
>     return 0;
> }
> void func() {}
> 
> This will crash the compiler (v. 0.35).
> Is this a known bug? Isn't this code correct?

It is definitely a bug, and it is even worse: the compiler crashes every time a function pointer is found where a constant expression is expected - which includes initializers for global and static variables.