Identifier right after a template Type

Puneet Goel puneet at coverify.com
Thu Jun 22 07:49:31 UTC 2023


Currently, D allows putting an identifier right after a string 
which may be part of a template instance. Should there not be a 
mandatory whitespace between the type and the identifier?

For example, the following code is valid:

```D
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);
}

// Output:
// p.bb
// p.c  // q{foo}c is taken as a string
```

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


More information about the Digitalmars-d mailing list