← Back to index
|
Original Bugzilla link
Bug 14109 – [REG2.066.1] Property-like function call does not work on template value parameter
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-02-02T02:11:00Z
Last change time
2015-02-03T20:29:28Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
timothee.cour2
Comments
Comment #0
by timothee.cour2 — 2015-02-02T02:11:37Z
dmd -unittest -c -o- main.d 2.066: works git head(v2.067-devel-e542e14): Error: no property 'z' for type 'Proxy!(true, a, null)' ---- auto setFields_aux(bool isRef,alias foo,string s,T...)(T args){ import std.array:split; import std.conv:to; enum namesCall=split(s,","); static assert(namesCall.length==T.length); static if(isRef){ enum foo2_name="foo"; } else{ auto foo2=foo; enum foo2_name="foo2"; } string getString() { string ret; foreach(i,vali ; namesCall){ ret~=foo2_name~`.`~vali~`=`~`args[`~i.to!string~`];`; } ret~=`return `~foo2_name~`;`; return ret; } mixin(getString()); } private struct Proxy (bool isRef,alias func, string parameters, Args ...) { private static string addParameter (string parameters, string newParameter) () { return parameters is null ? newParameter : parameters ~ "," ~ newParameter; } Args args; this(int dummy,Args args){ static if(Args.length) this.args=args; } auto opDispatch (string name, T) (T value) { return Proxy!(isRef,func, addParameter!(parameters, name), Args, T)(0,args, value); } auto opCall()() { return setFields_aux!(isRef,func, parameters)(args); } } auto ref setfieldsRef(T)(ref T a){ return Proxy!(true,a, null)(0); } auto setfields(T)(T a){ return Proxy!(true,a, null)(0); } auto setfields(T)(){ T a; return Proxy!(true,a, null)(0); } unittest{ struct A{ string z; } auto a0=A("a"); assert(A.init.setfields.z("a")() == a0); } ----
Comment #1
by k.hara.pg — 2015-02-03T09:49:57Z
Reduced test case: string addParameter()() { return ""; } struct Proxy(string parameters) {} alias P = Proxy!(addParameter!()); // works with 2.066, but doesn't work with 2.066.1 Introduced in:
https://github.com/D-Programming-Language/dmd/pull/3897
Comment #2
by k.hara.pg — 2015-02-03T10:46:39Z
https://github.com/D-Programming-Language/dmd/pull/4375
Comment #3
by github-bugzilla — 2015-02-03T20:29:28Z
Commits pushed to master at
https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/bcd157daa58bc84edddc2d5eeeaae7e8e001eca7
fix Issue 14109 - Property-like function call does not work on template value parameter
https://github.com/D-Programming-Language/dmd/commit/e8dba387fcaa55f176891750c83dba6513ccba69
Merge pull request #4375 from 9rnsr/fix14109 [REG2.066.1] Issue 14109 - Property-like function call does not work on template value parameter