www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21953] New: arrayop accepted on array of noreturn, leading to

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 puremagic.com
          Reporter: b2.temp 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.

--
May 22 2021