www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21866] New: Templates confuse error message to use wrong

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 puremagic.com
          Reporter: crazymonkyyy 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 --
Apr 26