www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14035] New: string concatenation accepts ints in templates

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

          Issue ID: 14035
           Summary: string concatenation accepts ints in templates
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: ketmar ketmar.no-ip.org

the following code happily compiles:

  template alice (usize ln=__LINE__) {
    enum alice = "{ int t_"~ln~" = 42; }";
  }
  pragma(msg, alice!());

it uses `ln` value as character code, which seems to be wrong, as trying to do
the same in ordinary function fails with the following message:

  Error: incompatible types for (("{ int t_") ~ (ln)): 'string' and 'uint'

--
Jan 23 2015