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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 29 10:31:08 PDT 2006


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!

((
While we're at it, should storage attributes be allowed in a typedef? Like:
"typedef static const final override auto int sometype;" ?
It also seems to me not.
))

Whichever the case (even without changes), the spec grammar should also be
corrected. An example of a current doc error is:

        typedef Decl
  Decl:
        ...
        BasicType Declarator FunctionBody

but the compiler does not accept typedefs with function bodies.


-- 




More information about the Digitalmars-d-bugs mailing list