Thread overview | |||||
---|---|---|---|---|---|
|
July 24, 2002 bug (static function pointer) ? | ||||
---|---|---|---|---|
| ||||
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 Re: bug (static function pointer) ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dario | 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 Re: bug (static function pointer) ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dario | 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.
|
Copyright © 1999-2021 by the D Language Foundation