Bug 14874 – __traits(getFunctionAttributes) does not support the new `return` attribute
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-08-06T01:36:00Z
Last change time
2017-07-22T12:36:27Z
Assigned to
monkeyworks12
Creator
monkeyworks12
Comments
Comment #0 by monkeyworks12 — 2015-08-06T01:36:38Z
import std.traits;
struct Test
{
int n;
ref int getN() return
{
return n;
}
}
void main()
{
//fails
assert(functionAttributes!(Test.getN) & FunctionAttribute.return_);
}
Comment #1 by monkeyworks12 — 2015-08-06T20:41:33Z
After some investigating, it seems that the fault lies with __traits(getFunctionAttributes).
import std.traits;
struct Test
{
int n;
ref int getN() return
{
return n;
}
}
void main()
{
//Prints `tuple("ref", "@system")`
pragma(msg, __traits(getFunctionAttributes, Test.getN));
}
Comment #2 by github-bugzilla — 2015-08-12T05:42:03Z