June 19, 2023
https://issues.dlang.org/show_bug.cgi?id=23999

          Issue ID: 23999
           Summary: Potentially Ambiguous Template Instatiation
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: puneet@coverify.org

Currently, DMD allows variable declaration without whitespace after a template instance that takes a string as a parameter. This leads to potentially ambiguous code. Consider:


class Foo(string str) {
  enum STR = str;
}
class Bar {
  Foo!q{foo}bb;
  Foo!q{foo}cc;
}
void main() {
  Bar p;
  pragma(msg, p.tupleof[0].stringof);
  pragma(msg, p.tupleof[1].stringof);
}



// The compiler outputs:
//
// p.bb
// p.c

--