[Issue 21966] New: elem ~ elem could yield elem[]

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 25 12:46:31 UTC 2021


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

          Issue ID: 21966
           Summary: elem ~ elem could yield elem[]
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: b2.temp at gmx.com

idea hidden in DMD compiler

---
void main()
{
    char[] ab = 'a' ~ 'b';
    int[] z1 =  0 ~  1;
}    
---

CatExp of two compatible elems could result into a dynamic array, instead of
the current errors:

>/tmp/temp_7F4CF56284B0.d:5:17: Error: incompatible types for `(cast(int)'a') ~ (cast(int)'b')`: both operands are of type `int`
>/tmp/temp_7F4CF56284B0.d:6:17: Error: incompatible types for `(0) ~ (1)`: both operands are of type `int`

--


More information about the Digitalmars-d-bugs mailing list