[Issue 16389] "const" should be inferred for template methods

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Aug 15 06:22:54 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16389

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com

--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> ---
One can do this already, though I agree it would be nice if this was the
default:

struct S
{
   int _x;
   int x(this T)() { return _x; }
}

void main()
{
   S s;
   const S cs;
   writeln(s.x, cs.x);
}

--


More information about the Digitalmars-d-bugs mailing list