On 27.02.19 19:10, Dukc wrote:
I tested a bit, and it appears that attribute inference is not done at
all for templates inside structs -the attribute need not be a delegate:
struct S
{
static int fImpl(Ret)() { return Ret.init; }
pragma(msg, __traits(getFunctionAttributes, fImpl!int)); //
still tells us: `f` is @system
}
void main(){}
A bug, unless I'm overlooking something.
It's not quite as simple as that. When you put the pragma in a function,
the inferred attributes show up:
----
struct S
{
void f()() {}
}
pragma(msg, __traits(getFunctionAttributes, S.f!())); /* @system */
void g()
{
pragma(msg, __traits(getFunctionAttributes, S.f!()));
/* Same line now says @safe. */
}
----
But I agree that this can't be right.