[Issue 3827] Warn against and then deprecate implicit concatenation of adjacent string literals

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Apr 30 06:02:43 PDT 2014


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

--- Comment #35 from bearophile_hugs at eml.cc ---
(In reply to Stewart Gordon from comment #34)

> > void main() @nogc {
> >     string s1 = "AB" "CD";   // OK
> >     string s2 = "AB" ~ "CD"; // Error
> > }
> > 
> > 
> > temp.d(3,17): Error: cannot use operator ~ in @nogc function main
> 
> That's a separate bug - please file it if it isn't already there.

I don't understand what you suggest me to file. A line of code "string s2 =
"AB" ~ "CD";" performs a run-time array concatenation, that always performs a
memory allocation, so it can't be @nogc.

--


More information about the Digitalmars-d-bugs mailing list