www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23777] New: Can't strip shared qualifier from static array type

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

          Issue ID: 23777
           Summary: Can't strip shared qualifier from static array type
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

As of DMD 2.102.2, the following programs fail to compile:

---
// example 1
static if (is(shared(int[1]) == shared(T), T))
    static assert(is(T == int[1]));
---

---
// example 2
shared(int[1]) a;
static assert(is(typeof(cast() a) == int[1]));
---

---
// example 3
alias Unshared(T : shared(U), U) = U;
static assert(is(Unshared!(shared(int[1])) == int[1]));
---

In all cases, the error message is as follows:

---
bug.d(2): Error: static assert:  `is(shared(int[1]) == int[1])` is false
---

In each of these programs, the 'shared' qualifier should be stripped from the
type on the left-hand side of the assert expression, but it is not.

--
Mar 13 2023