Bug 3756 – std.traits.ReturnType broken for ref returns

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-01-30T15:54:00Z
Last change time
2015-06-09T01:27:38Z
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2010-01-30T15:54:58Z
import std.traits; ref uint foo(ref uint num) { return num; } pragma(msg, ReturnType!(foo)); // uint, not ref uint.
Comment #1 by andrej.mitrovich — 2012-12-21T07:30:46Z
Type modifiers can't be passed around in the language, but I think there's a separate issue already opened for this. Anyway you can do: import std.traits; ref uint foo(ref uint num) { return num; } void main() { alias FunctionAttribute FA; static assert(functionAttributes!foo & FA.ref_); }