www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17333] New: Disallow CT concat of string with integer

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

          Issue ID: 17333
           Summary: Disallow CT concat of string with integer
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: nick geany.org

int n = 2;
//enum int n = 2;
string s = "" ~ n;

The above with dmd v2.074.0 produces:
ctforeachn.d(18): Error: incompatible types for (("") ~ (n)): 'string' and
'int'

However, using enum for n instead, the code compiles. It should produce the
same error.

--
Apr 19