[Issue 7161] Passing string literal by ref changes its bounds forever
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sat Dec 24 05:21:40 PST 2011
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=7161
Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com
--- Comment #2 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2011-12-24 05:21:38 PST ---
I'll do you one better:
void g1() { f("abc".s); }
void g2() { f("abc".s); }
ref string s_impl()(string s)
{
    static string ss;
    ss = s;
    return ss;    
}
ref string s(string s) 
{
    return s_impl!()(s);
}
void main()
{
    g1();     
    g2();     
    f("abc".s);
    f("abc".s);
    f("abc".s);
}
-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
    
    
More information about the Digitalmars-d-bugs
mailing list