Bug 14369 – ParameterDefaultValue does not work with convertion using a non-ctfe able opCall / ctor

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-03-28T20:23:01Z
Last change time
2024-12-13T18:41:43Z
Assigned to
No Owner
Creator
Mathias LANG
Moved to GitHub: dmd#18966 →

Comments

Comment #0 by pro.mathias.lang — 2015-03-28T20:23:01Z
Currently, the following code will fail to compile: ```` void main() { import std.datetime, std.traits; interface IKeysAPI { string create(SysTime expiry = 0); } alias ParamDefaults = ParameterDefaultValueTuple!(IKeysAPI.create); } ```` IIUC, when getting a value using `__parameters`, the value is expected to be of the type of the argument, and thus is converted as soon as anyone tries to read it. I marked it as a DMD bug because I believe it should not try to do the convertion, but rather expose more informations than just a typetuple and let the library's contributor decide. Ultimately, what I'll be aiming for is something like a struct with: - 'Type' => alias to the type of the parameter. - 'identifier' => Well you get it. - 'value' => Default value of the parameter. Either a TypeTuple with one or 0 entry, or another brighter solution. This should take into account that default value can be C function calls (like `time_t currTime = time(null)`), which is why this field could be an alias.
Comment #1 by robert.schadek — 2024-12-13T18:41:43Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18966 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB