[Issue 16445] string mixin allows shebang line in source

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Aug 30 03:10:12 PDT 2016


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

--- Comment #2 from Cauterite <cauterite at gmail.com> ---
(In reply to b2.temp from comment #1)
> So there is no bug. The shebang is removed as specified. You can also see
> that if you add a space before, an error is emitted.

Well the bug is that shebang lines aren't applicable to string mixins, because
they're not executed from a shell, so they should be a syntax error regardless.
Especially if the mixin is an expression, where accepting a shebang line makes
no sense whatsoever.

The lexer has only one constructor, and it always strips "#!…\n" off
unconditionally:
https://github.com/dlang/dmd/blob/fb64019c2251d5f447967b9e796de8afc76e6226/src/lexer.d#L187

--


More information about the Digitalmars-d-bugs mailing list