www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19753] New: Array ops should not need TypeInfo

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

          Issue ID: 19753
           Summary: Array ops should not need TypeInfo
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/
                OS: All
            Status: NEW
          Severity: major
          Priority: P3
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: Ajieskola gmail.com

The following snippet does not compile with the -betterC flag:

```
__gshared int[2] a = [5, 5];
__gshared int[2] b = [7, 5];
__gshared int[2] c;
extern (C) export void _start(){c[] = a[] + b[];}
```

Error message (with both dmd 2.085.0 ldc 1.14.0) is `[compiler import
path]\druntime\import\object.d(4502): Error: TypeInfo cannot be used with
-betterC`. By removing the array addition operation, this example compiles.

Unless I'm mistaken, the program should not need runtime type information to
perform an array operation like this, and thus it should be doable in better C
mode.

--
Mar 19 2019