[Issue 17816] New: Casting of AliasSeq is silently ignored

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Sep 7 13:54:11 UTC 2017


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

          Issue ID: 17816
           Summary: Casting of AliasSeq is silently ignored
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: simen.kjaras at gmail.com

import std.meta : AliasSeq;
    AliasSeq!(float) a;
    auto b = cast(int)a;
    static assert(is(typeof(b[0]) == float));

The above assert passes. I would argue the cast is nonsensical and should
result in a compilation failure, though an argument could be presented for
casting all elements to int. Neither of these happen with the current compiler.

--


More information about the Digitalmars-d-bugs mailing list