March 02, 2009 [Issue 2704] New: Constness lost when passing a struct member by alias | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2704 Summary: Constness lost when passing a struct member by alias Product: D Version: 2.025 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: samukha@voliacable.com If we can't access a struct/class member passed by alias (hopefully, this will be fixed some day), we at least should be able to get correct type information. struct S { int x; } template Foo(T, alias u) { static assert(is(typeof(u) == T)); //fails } void main() { immutable s = S(); alias Foo!(typeof(s.x), s.x) foo; } The alias gets stripped of constness when passed to the template. -- |
Copyright © 1999-2021 by the D Language Foundation