http://d.puremagic.com/issues/show_bug.cgi?id=7521
Summary: Add const inference for templated method and delegate parameters Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: timon.g...@gmx.ch --- Comment #0 from timon.g...@gmx.ch 2012-02-16 07:50:25 PST --- Not only pure/nothrow/@safe should be inferred, but const on parameters and methods should be inferred too. This increases the expressiveness of alias parameters and is required for making templates const correct. Inferring const for delegate parameters reduces the annotation overhead and makes treatment of template delegate literals uniform with normal delegate literals. IOW, the following code should compile: int glob; class Foo(alias a){ int x; void foo(){a(this);} static int bar(Foo x){return a(foo);} } void main(){ alias Foo!((p){glob=p.x;}) T; // parameter p inferred const auto foo = new immutable(T); foo.foo(); // OK, T.foo inferred const T.bar(foo); // OK, parameter x of T.bar inferred const (T x){glob = x.x;}(foo); // OK, parameter x inferred const } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------