Why can't the compiler properly detect the type of Array!string("something")?

Adnan relay.public.adnan at outlook.com
Sun Mar 15 00:04:09 UTC 2020


On Saturday, 14 March 2020 at 23:54:44 UTC, Adam D. Ruppe wrote:
> On Saturday, 14 March 2020 at 23:39:11 UTC, Adnan wrote:
>> Full code
>
> this worked for me when i copy/pasted it... are you sure that 
> has the error? if so what compiler version you on?

This is indeed very strange, godbolt says it's alright: 
https://d.godbolt.org/z/DaaPxX

Now my compiler version:
$ dmd --version && ldc2 --version
DMD64 D Compiler v2.090.0
Copyright (C) 1999-2019 by The D Language Foundation, All Rights 
Reserved written by Walter Bright
LDC - the LLVM D compiler (1.18.0):
   based on DMD v2.088.1 and LLVM 9.0.0
   built with LDC - the LLVM D compiler (1.18.0)
   Default target: x86_64-unknown-linux-gnu
   Host CPU: znver1
   http://dlang.org - http://wiki.dlang.org/LDC

   Registered Targets:
     aarch64    - AArch64 (little endian)
     aarch64_32 - AArch64 (little endian ILP32)
     aarch64_be - AArch64 (big endian)
     arm        - ARM
     arm64      - ARM64 (little endian)
     arm64_32   - ARM64 (little endian ILP32)
     armeb      - ARM (big endian)
     mips       - MIPS (32-bit big endian)
     mips64     - MIPS (64-bit big endian)
     mips64el   - MIPS (64-bit little endian)
     mipsel     - MIPS (32-bit little endian)
     msp430     - MSP430 [experimental]
     nvptx      - NVIDIA PTX 32-bit
     nvptx64    - NVIDIA PTX 64-bit
     ppc32      - PowerPC 32
     ppc64      - PowerPC 64
     ppc64le    - PowerPC 64 LE
     riscv32    - 32-bit RISC-V
     riscv64    - 64-bit RISC-V
     thumb      - Thumb
     thumbeb    - Thumb (big endian)
     wasm32     - WebAssembly 32-bit
     wasm64     - WebAssembly 64-bit
     x86        - 32-bit X86: Pentium-Pro and above
     x86-64     - 64-bit X86: EM64T and AMD64


Note that both ldc2 and dmd has the same complain


More information about the Digitalmars-d-learn mailing list