www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21477] New: TypeInfo errors in betterC are cryptic

https://issues.dlang.org/show_bug.cgi?id=21477

          Issue ID: 21477
           Summary: TypeInfo errors in betterC are cryptic
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dave287091 gmail.com

A minimal program, compiled with -betterC:

extern(C) int main(){
    int[] foo = [1];
    return 0;
}

Yields the error message:

bug.d(2): Error: TypeInfo cannot be used with -betterC


It is correct to error, but the error is hard to understand.
It would be much nicer nice if the error reported what it was trying to
generate type info for (the usage that forces generation of type info can be
very far from the declaration) and why TypeInfo was being generated in this
case.

Also, it is not clear to me that this is even the right error message. Why is
it complaining about TypeInfo when the real issue is you can’t use
runtime-managed dynamic arrays in betterC?

--
Dec 12 2020