[Issue 14369] New: ParameterDefaultValue does not work with convertion using a non-ctfe able opCall / ctor
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Mar 28 13:23:01 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14369
Issue ID: 14369
Summary: ParameterDefaultValue does not work with convertion
using a non-ctfe able opCall / ctor
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: pro.mathias.lang at gmail.com
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.
--
More information about the Digitalmars-d-bugs
mailing list