[Issue 14737] New: [2.068 beta] Array concatenation fails in enum declaration
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Thu Jun 25 21:51:02 PDT 2015
    
    
  
https://issues.dlang.org/show_bug.cgi?id=14737
          Issue ID: 14737
           Summary: [2.068 beta] Array concatenation fails in enum
                    declaration
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: industry, rejects-valid
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: briancschott at gmail.com
```
private struct S
{
    int a;
    int b;
    int c;
}
void main()
{
    import std.traits:FieldNameTuple;
    enum string[2] a = ["d", "e"];
    enum b = [FieldNameTuple!S] ~ a;
    string[2] a2 = ["c", "d"];
    auto b2 = [FieldNameTuple!S] ~ a2;
}
```
With 2.067.1 this fails with the following error:
test.d(16): Error: e2ir: cannot cast ["a", "b", "c"] of type string[] to type
string[2]
That's a bug, but at least the enum case was allowed to compile.
With 2.068.0-b1, it fails with this error:
test.d(12): Error: cannot cast expression ["a", "b", "c"] of type string[] to
string[2]
test.d(16): Error: cannot cast expression ["a", "b", "c"] of type string[] to
string[2]
--
    
    
More information about the Digitalmars-d-bugs
mailing list