[Issue 14035] string concatenation accepts ints in templates

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


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

--- Comment #3 from yebblies <yebblies at gmail.com> ---
(In reply to Ketmar Dark from comment #2)
> 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!

No, ln is a run-time argument here.  Semantic analysis is run on 'alice'
without knowing it will be called from a compile-time context.

--


More information about the Digitalmars-d-bugs mailing list