Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
February 09, 2004 [Segfaulting BUG] typedefing function pointers | ||||
---|---|---|---|---|
| ||||
The following code crash dmd with no error message: <-------------------- int function() foo; typedef foo bar; <-------------------- I suppose it isn't allowed to typedef function pointers, but still, an error message would be nice :) Lars Ivar Igesund |
February 09, 2004 Re: [Segfaulting BUG] typedefing function pointers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Ivar Igesund | Another one in a similar vein. The following code crash
dmd with no error message:
<----------------------
int function() foo;
int bar(foo fp);
<----------------------
I believe that function pointers as function parameters
are allowed.
Lars Ivar Igesund
Lars Ivar Igesund wrote:
> The following code crash dmd with no error message:
>
> <--------------------
>
> int function() foo;
> typedef foo bar;
>
> <--------------------
>
> I suppose it isn't allowed to typedef function pointers,
> but still, an error message would be nice :)
>
> Lars Ivar Igesund
|
February 09, 2004 Re: [Segfaulting BUG] typedefing function pointers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Ivar Igesund | Lars Ivar Igesund wrote:
> Another one in a similar vein. The following code crash
> dmd with no error message:
>
> <----------------------
>
> int function() foo;
> int bar(foo fp);
>
> <----------------------
>
> I believe that function pointers as function parameters
> are allowed.
But isn't foo a variable not a type?
Should error anyway.
Sam
|
February 10, 2004 Re: [Segfaulting BUG] typedefing function pointers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Ivar Igesund | Lars Ivar Igesund wrote:
> The following code crash dmd with no error message:
>
> <--------------------
>
> int function() foo;
> typedef foo bar;
>
> <--------------------
>
> I suppose it isn't allowed to typedef function pointers,
> but still, an error message would be nice :)
the expression 'int function() foo;' doesn't declare a type. It creates a global called foo, which is a pointer to a function that accepts no arguments, and returns an int.
'typedef foo bar;' on the next line is therefore complete nonsense.
What you probably want is
typedef int function() bar;
Regardless, it shouldn't segfault the compiler. :)
-- andy
|
February 10, 2004 Re: [Segfaulting BUG] typedefing function pointers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sam McCall | Sam McCall wrote:
> Lars Ivar Igesund wrote:
>
>> Another one in a similar vein. The following code crash
>> dmd with no error message:
>>
>> <----------------------
>>
>> int function() foo;
>> int bar(foo fp);
>>
>> <----------------------
>>
>> I believe that function pointers as function parameters
>> are allowed.
>
> But isn't foo a variable not a type?
> Should error anyway.
> Sam
You're right of course. My fault. But it shouldn't segfault.
Lars Ivar Igesund
|
February 10, 2004 Re: [Segfaulting BUG] typedefing function pointers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy Friesen | Andy Friesen wrote:
> Lars Ivar Igesund wrote:
>
>> The following code crash dmd with no error message:
>>
>> <--------------------
>>
>> int function() foo;
>> typedef foo bar;
>>
>> <--------------------
>>
>> I suppose it isn't allowed to typedef function pointers,
>> but still, an error message would be nice :)
>
>
> the expression 'int function() foo;' doesn't declare a type. It creates a global called foo, which is a pointer to a function that accepts no arguments, and returns an int.
>
> 'typedef foo bar;' on the next line is therefore complete nonsense.
>
> What you probably want is
>
> typedef int function() bar;
>
> Regardless, it shouldn't segfault the compiler. :)
>
> -- andy
You're right of course. My fault. But it shouldn't segfault anyway.
Lars Ivar Igesund
|
Copyright © 1999-2021 by the D Language Foundation