Bug 10465 – ReturnType does not store the storage class

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-24T13:55:34Z
Last change time
2020-03-21T03:56:36Z
Assigned to
No Owner
Creator
Andrej Mitrovic

Comments

Comment #0 by andrej.mitrovich — 2013-06-24T13:55:34Z
----- import std.traits; ref int foo(ref int); void main() { alias ReturnType!foo function(ParameterTypeTuple!foo) Bar; int x; Bar bar; static assert(!__traits(compiles, bar(5) )); // ok, can't take r-value static assert(__traits(compiles, bar(x) )); // ok, takes l-value pragma(msg, Bar); // 'int function(ref int)' -- missing ref return bar(x) = 5; // Error: (*bar)(x) is not an lvalue } -----
Comment #1 by b2.temp — 2017-01-23T07:05:31Z
But "ref" is not a type ctor (https://dlang.org/spec/declaration.html#typequal_vs_storageclass). The alias returned by ReturnType type is correct.