June 06, 2022
https://issues.dlang.org/show_bug.cgi?id=23162

          Issue ID: 23162
           Summary: cannot use new on a static array type that's aliased
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: b2.temp@gmx.com

## test case

```
void main(string[] args)
{
    alias A = int[1];
    new A;
}
```

## output

> /tmp/temp_7F65DA6E8630.d:4:5: Error: cannot create a `int[1]` with `new`

## notes

- should be accepted
- seems to be caused because of the fix for
https://issues.dlang.org/show_bug.cgi?id=11581 is applied before the type sema
of the new'd stuff

## proposed patch

NewExp sema is a mess. A medium quality fix is to re-run the NewExp sema if a static array type appears after the type sema of the new'd stuff

---
@@ -3483,11 +3483,20 @@ private extern (C++) final class
ExpressionSemanticVisitor : Visitor
             exp.type = exp.newtype.typeSemantic(exp.loc, sc);
             sc = sc.pop();
         }
         else
         {
+            auto ts1 = exp.newtype.isTypeSArray();
             exp.type = exp.newtype.typeSemantic(exp.loc, sc);
+            //  got an alias, but fix for 11581 is missed
+            if (!ts1 && exp.type.isTypeSArray())
+            {
+                exp.newtype  = exp.type;
+                exp.type = null;
+                visit(exp);
+                return;
+            }
         }
         if (exp.type.ty == Terror)
             return setError();

         if (edim)
---

--