www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18620] New: `error cannot be interpreted at compile time` is


          Issue ID: 18620
           Summary: `error cannot be interpreted at compile time` is
                    missing context where error occurs
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: timothee.cour2 gmail.com

--- main.d
class A{
    this(const(char)* s)
        import core.stdc.string;
        auto a=strlen(s);

void main(){
  // likewise with __gshared
  static auto a = new A("a");

main.d(5): Error: strlen cannot be interpreted at compile time, because it has
no available source code

it should show where it's instantiated (ie line with `static auto a = new
A("a");`) otherwise it can be really hard to figure out what caused it in
complex scenarios

Mar 15 2018