[Issue 270] New: Compiler allows and crashes on typedefs of "immediate"-function types

Don Clugston dac at nospam.com.au
Mon Jul 31 23:43:51 PDT 2006


d-bugmail at puremagic.com wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=270
> 
>            Summary: Compiler allows and crashes on typedefs of "immediate"-
>                     function types
>            Product: D
>            Version: 0.163
>           Platform: PC
>         OS/Version: Windows
>             Status: NEW
>           Keywords: accepts-invalid, ice-on-invalid-code, spec
>           Severity: normal
>           Priority: P2
>          Component: DMD
>         AssignedTo: bugzilla at digitalmars.com
>         ReportedBy: daiphoenix at lycos.com
> 
> 
> Compiler allows and crashes on typedefs of "immediate"-function types,
> where "immediate-function" types are non-pointer function types.
> Code example:
> 
>   typedef int ft(int);
>   //typedef typeof(test) fp; // This alternative typedef also crashes
> 
>   void test()
>   {
>     ft[10] a;
>   }
> 
> ---
> This raises the issue: should a typedef of an "immediate" function type even be
> allowed? Seems to me not, as one can't use the typedef for any declaration!

You can make a pointer to it.

ft * p;

But I agree that there doesn't seem to be any need for it. I find those 
declarations terribly confusing. I think it's another one of the silly C 
corner cases that we'd be better off without.

Also, it's worth considering entirely removing C-style function 
declarations from D, now that we have the htod tool. My experience in 
manually converting the Windows API headers was that there is negligible 
effort involved in converting to D 'function' declarations, anyway.



More information about the Digitalmars-d-bugs mailing list