digitalmars.D.bugs - [Issue 19906] New: __traits(isRef) always yields false for auto ref
- d-bugmail puremagic.com (37/37) May 27 2019 https://issues.dlang.org/show_bug.cgi?id=19906
https://issues.dlang.org/show_bug.cgi?id=19906 Issue ID: 19906 Summary: __traits(isRef) always yields false for auto ref parameter Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: andrei erdani.com Consider: import std.stdio; void fun(T)(auto ref T x) { pragma(msg, __PRETTY_FUNCTION__); static if (is(__traits(isRef, x))) { writeln("ref: ", x); } else { writeln("non ref: ", x); } } void main() { int a; fun(a); fun(42); } This prints: void onlineapp.fun!int.fun(ref int x) void onlineapp.fun!int.fun(int x) non ref: 0 non ref: 42 It should print: void onlineapp.fun!int.fun(ref int x) void onlineapp.fun!int.fun(int x) ref: 0 non ref: 42 --
May 27 2019