[Issue 14035] string concatenation accepts ints in templates

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


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

yebblies <yebblies at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies at gmail.com
         Resolution|---                         |WONTFIX

--- Comment #1 from yebblies <yebblies at gmail.com> ---
'ln' is a template parameter, so its value is known when semantic is run on the
enum's initializer.  Because it is a constant value known to fit in a char
type, it is implicitly converted to char and the concatenation succeeds.

You can see the expected error if you move the pragma(msg) line below line 255.

The implicit conversion from int to char is supported for cases like this:
"string " ~ ('a' + 1) which would otherwise fail.

--


More information about the Digitalmars-d-bugs mailing list