www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18543] New: Comments inside string mixin silently


          Issue ID: 18543
           Summary: Comments inside string mixin silently short-circuit
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: edi33416 gmail.com

I have recently stumbled upon the following wrong behaviour inside string

If you use a single line style comment (//) inside a string mixin, this will
silently short-circuit the code, leading to unexpected behaviour, as you can
see in the example bellow:

import std.stdio;

void main(string[] args)
    ~"// Some comment"                                                          

The assert will never get triggered.

If you use multi-line comments (/* */) those are correctly recognized and
everything works as expected.

Mar 01 2018