[Issue 21866] New: Templates confuse error message to use wrong string litteral

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 26 18:44:26 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21866

          Issue ID: 21866
           Summary: Templates confuse error message to use wrong string
                    litteral
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: crazymonkyyy at gmail.com

template setup(string s){
        void dosomething(){
                mixin(s);
        }
}
void main(){
        int s;
        mixin setup!"s=1;";
        dosomething;
        s.writeln;
}

>mix(2): Error: cannot modify string literal `"s=1;"`

Should read "cant modify string literal "s"", "s=1" is not being modified and
with the original code was completely unrelated

--


More information about the Digitalmars-d-bugs mailing list