[Issue 14035] string concatenation accepts ints in templates

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Mar 21 21:36:42 PDT 2015


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

Ketmar Dark <ketmar at ketmar.no-ip.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ketmar at ketmar.no-ip.org

--- Comment #2 from Ketmar Dark <ketmar at ketmar.no-ip.org> ---
the same logic should allow this:

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

yet somehow this is not working. but why? `ln` is known in compile time too!

it's inconsistend and breaking type system. but ok, it's another arcane D
knowledge, which can't be logically explained and can be only remembered. one
more, one less...

--


More information about the Digitalmars-d-bugs mailing list