Is betterC affect to compile time?

Oleg B code.viator at gmail.com
Thu Jul 25 12:01:40 UTC 2019


Hello everyone!

I try build this code with betterC

import core.stdc.stdio;
import std.format : format;

extern(C) int main()
{
     mixin(format!`enum str = "%s\0";`("hello"));
     fprintf(stderr, "%s\n", str.ptr);
     return 0;
}

but compilation fails

/dlang/dmd/linux/bin64/../../src/phobos/std/format.d(6278): 
Error: Cannot use try-catch statements with -betterC
/dlang/dmd/linux/bin64/../../src/phobos/std/format.d(6308): 
Error: template instance `std.format.checkFormatException!("enum 
str = \"%s\\0\";", string)` error instantiating
onlineapp.d(6):        instantiated from here: format!("enum str 
= \"%s\\0\";", string)
/dlang/dmd/linux/bin64/../../src/phobos/std/format.d(6311):       
  while evaluating: static assert(!e)
/dlang/dmd/linux/bin64/../../src/phobos/std/array.d(3204): Error: 
TypeInfo cannot be used with -betterC

Is this a bug?

https://run.dlang.io/is/TG1uhg


More information about the Digitalmars-d-learn mailing list