Bug 13293 – `typeof(<function returning T>)` gets printed as `T()`

Status
NEW
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2014-08-14T11:26:07Z
Last change time
2024-12-13T18:23:56Z
Assigned to
No Owner
Creator
Marc Schütz
Moved to GitHub: dmd#18867 →

Comments

Comment #0 by schuetzm — 2014-08-14T11:26:07Z
From http://forum.dlang.org/post/[email protected]: struct Result { public @property auto save1() { return this; } public auto save2() { return this; } } pragma(msg, typeof(Result.init.save1)); pragma(msg, typeof(Result.init.save2)); This outputs: Result Result() I guess the second type is supposed to represent the function? It should print something that makes this clear, `Result()` doesn't make sense.
Comment #1 by schuetzm — 2015-06-06T11:37:15Z
With latest DMD from Git, this now prints "pure nothrow @nogc @safe Result()", which is still wrong.
Comment #2 by stanislav.blinov — 2021-12-08T17:33:37Z
What would be the expected output?
Comment #3 by hsteoh — 2021-12-08T17:58:22Z
I'd expect something like `Result function()` or something along those lines, rather than `Result()` which looks like a ctor invocation.
Comment #4 by robert.schadek — 2024-12-13T18:23:56Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18867 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB