is this a bug ? mixin template static function missing!
Simen Kjærås
simen.kjaras at gmail.com
Fri Aug 10 12:05:52 UTC 2018
On Friday, 10 August 2018 at 11:17:10 UTC, learnfirst1 wrote:
> I think the static extern(C) nested function should just work
> like global extern(C) function. DMD still report missing
> symbols. Or I am wrong about this ?
>
> template G(){
> static extern(C) pragma(crt_constructor) void init(){}
> }
> void main(){
> mixin G!(); // Line 5
> init();
> }
If you try the same without the mixin template, you'll see that
it doesn't work:
void main() {
static extern(C) pragma(crt_constructor) void init();
init();
}
Depending on the order of static, extern(C) and
pragma(crt_constructor), you can get at least two different error
messages, but either way - it doesn't work.
It would be possible to make this work by changing the compiler,
but according to spec, it shouldn't.
--
Simen
More information about the Digitalmars-d-learn
mailing list