[Issue 17766] New: Wrong choice of generic mutable/const/immutable methods
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Aug 19 22:19:27 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17766
Issue ID: 17766
Summary: Wrong choice of generic mutable/const/immutable
methods
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ilyayaroshenko at gmail.com
static struct Foo()
{
char opIndex(Indexes...)(Indexes indexes) immutable
{
return 'i';
}
char opIndex()() const
{
return 'c';
}
char opIndex(Indexes...)(Indexes indexes)
{
return 'm';
}
}
pragma(msg, Foo!()()[]);
pragma(msg, (cast(const) Foo!()())[]);
pragma(msg, (cast(immutable) Foo!()())[]);
Prints
'c'
'c'
'c'
But shuold be
'm'
'c'
'i'
Type qualifier should have priority.
--
More information about the Digitalmars-d-bugs
mailing list