Comment #0 by monkeyworks12 — 2017-06-24T17:38:08Z
int test()
{
return 0;
}
void main()
{
pragma(msg, test.stringof);
}
It seems that the only way to make this work is add a no-args overload of `test`. It still seems that something weird is going on if I do that, however:
int test()
{
return 0;
}
void main()
{
//Prints "test()"
pragma(msg, test.stringof);
}
Currently I am resorting to a hacky workaround by doing `(&test).stringof[2..$]`.
Comment #1 by schveiguy — 2017-06-26T15:51:09Z
Correction, test has to take a parameter:
int test(int)
{
return 0;
}
Error message:
teststringof.d(8): Error: function teststringof.test (int _param_0) is not callable using argument types ()
teststringof.d(8): while evaluating pragma(msg, (__error).stringof)
Comment #2 by schveiguy — 2017-06-26T15:55:03Z
(In reply to monkeyworks12 from comment #0)
> Currently I am resorting to a hacky workaround by doing
> `(&test).stringof[2..$]`.
I've found another possible workaround:
__traits(identifier, test); // compile time literal of "test"
Comment #3 by monkeyworks12 — 2017-06-26T16:46:39Z
Ah, I forgot all about __traits(identifier). I wonder what the difference is between this and .stringof... Anyway, this should be a good enough workaround for the time being.