[Issue 21953] New: arrayop accepted on array of noreturn, leading to runtime failure or wrong code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun May 23 03:15:01 UTC 2021


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

          Issue ID: 21953
           Summary: arrayop accepted on array of noreturn, leading to
                    runtime failure or wrong code
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: accepts-invalid, wrong-code
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: b2.temp at gmx.com

this code is accepted but should not

---
alias noreturn = typeof(*null);

void main()
{
    noreturn[100] a;
    a[] = null;      // rt failure
    // a[55] = null; // Error: cannot implicitly convert expression `null` of
type `typeof(null)` to `noreturn`
}    
---

as the commented expstmt does not pass.

--


More information about the Digitalmars-d-bugs mailing list