[Issue 20744] [The D Bug Tracker] UDAs on function parameters confuse std.traits.ParameterDefaults
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Apr 17 17:41:16 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20744
Simen Kjaeraas <simen.kjaras at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |simen.kjaras at gmail.com
--- Comment #2 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
Definitely a compiler issue. It seems UDAs are being looked up in the scope
where the result of `is(Func PT == __parameters)` is being used. Here's a very
reduced example:
module foo;
import bar;
struct S {}
void f(@S int = 3);
pragma(msg, ParameterDefaults!f.stringof);
-----
module bar;
//enum S = 3; // Uncomment to make things compile
template ParameterDefaults(func...) {
static if (is(typeof(func[0]) PT == __parameters)) {
enum ParameterDefaults = (PT[0..1] args) @trusted {
return *&(args[0]);
}();
}
}
--
More information about the Digitalmars-d-bugs
mailing list