[Issue 2704] New: Constness lost when passing a struct member by alias
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 2 04:36:19 PST 2009
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 at digitalmars.com
ReportedBy: samukha at 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.
--
More information about the Digitalmars-d-bugs
mailing list