Bug 9855 – Type comparison does not work properly with subtyping

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-04-01T23:59:43Z
Last change time
2024-12-13T18:05:43Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Andrej Mitrovic
Moved to GitHub: dmd#18553 →

Comments

Comment #0 by andrej.mitrovich — 2013-04-01T23:59:43Z
struct Tuple(Types...) { alias TypeTuple = Types; alias TypeTuple this; } alias list = Tuple!int; void main() { static assert(is(list.TypeTuple[0] == int)); // ok pragma(msg, list[0]); // 'int' static assert(is(list[0] == int)); // ng }
Comment #1 by hsteoh — 2014-08-29T14:39:05Z
git HEAD may have regressed: ------ $ dmd test.d test.d(12): Error: no [] operator overload for type Tuple!int test.d(12): while evaluating pragma(msg, (Tuple!int)[0]) test.d(13): Error: static assert (is(Tuple!int[0] == int)) is false $ ------ Note the error on line 12, which is the pragma(msg) line.
Comment #2 by dlang-bugzilla — 2017-07-03T21:30:52Z
(In reply to hsteoh from comment #1) > git HEAD may have regressed: Broken by https://github.com/dlang/dmd/pull/443 (issue 6798) and later fixed by https://github.com/dlang/dmd/pull/4350 (issue 14057).
Comment #3 by robert.schadek — 2024-12-13T18:05:43Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18553 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB