www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17816] New: Casting of AliasSeq is silently ignored

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 puremagic.com
          Reporter: simen.kjaras 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.

--
Sep 07 2017