[Issue 3573] pure and nothrow allow function return type to be inferred

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jul 7 08:45:57 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=3573

Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #4 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
(In reply to Michal Minich from comment #0)
> 1. it is possible to declare function without specifying return type.
> 
> pure foo () {}
> pure foo () {}
> pure nothrow foo () {}

These are now implied to have an "auto" return type, i.e.:

pure foo () {}
pure bar () { return 1; }

pragma(msg, typeof(foo()).stringof); // prints "void"
pragma(msg, typeof(bar()).stringof); // prints "int"

--


More information about the Digitalmars-d-bugs mailing list