www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4746] New: CTFE regression + CTFE/normal execution differences (splitlines).

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4746

           Summary: CTFE regression + CTFE/normal execution differences
                    (splitlines).
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: peter.alexander.au gmail.com


--- Comment #0 from Peter Alexander <peter.alexander.au gmail.com> 2010-08-28
14:06:28 PDT ---
This is two bugs at once. The first is a regression in 2.048 from 2.047 where
splitlines is no longer CTFEable. The second is that, in 2.047, splitlines
doesn't work when CTFE'd.

// 2.048
void main()
{
    static auto s = splitlines("a\nb"); // Error: not CTFEable
    writeln(s[0]);
}

// 2.047
void main()
{
        auto s = splitlines("a\nb"); // Note non-static
    writeln(s[0]); // Writes 'a'... correct!
}

// 2.047
void main()
{
    static auto s = splitlines("a\nb"); // CTFE'd this time
    writeln(s[0]); // Writes nothing... incorrect!
}


Note that the 2.048 was run on Windows 7 and the 2.047 was run on Mac OS X Snow
Leopard.

Also note that string.split appears to have the same issue (was CTFEable in
2.047, but not in 2.048).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 28 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4746


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |INVALID


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-12-08 07:09:08 PST ---
Compiler versions before 2.048 silently generated wrong code for CTFE
situations like this one. This bug was fixed in 2.048, and it now (correctly)
says that it cannot compile it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 08 2010