www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6261] New: [2.054 beta regression] Regex cannot take a char[]

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

           Summary: [2.054 beta regression] Regex cannot take a char[]
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: Jesse.K.Phillips+D gmail.com
                CC: Jesse.K.Phillips+D gmail.com



13:30:08 PDT ---
The code below will not compile:

import std.regex;

void main(){
    auto re = regex("foo".dup);
}

src\phobos\std\regex.d(1537): Error: cannot cast a
read-only string literal to mutable in CTFE
src\phobos\std\regex.d(1537): Error: cannot evaluate 
tuple("","\x01") at compile time

I think there is a bug report on this, but also notice the instantiation line
isn't given (only the line in regex.d).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 06 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6261


Dmitry Olshansky <dmitry.olsh gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh gmail.com
          Component|DMD                         |Phobos
         AssignedTo|nobody puremagic.com        |dmitry.olsh gmail.com
           Severity|normal                      |regression



14:40:11 PDT ---
Well it's not a bug in DMD. The issue is that CTFE got an upgrade, and detects
more subtle bugs it seems.
The main issue is that it no longer works with mutable patterns.
This also fails:
import std.regex;
void main(){
    char[] a = new char[256];
    auto re = regex(a);
}

So it's a bug in std.regex, at that exact line. (Again: it is an issue of
sloppy typecheck)
I'll see about a proper fix.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 06 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6261




16:05:00 PDT ---
I wasn't sure as I didn't really expect any CTFE to be happening.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 06 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6261


Dmitry Olshansky <dmitry.olsh gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch



16:07:12 PDT ---
By the way here is the fix:
https://github.com/D-Programming-Language/phobos/pull/135

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 06 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6261


Dmitry Olshansky <dmitry.olsh gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jlquinn optonline.net



08:33:25 PDT ---
*** Issue 5652 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 30 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6261


Dmitry Olshansky <dmitry.olsh gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



13:39:59 PDT ---
Fixed
https://github.com/D-Programming-Language/phobos/commit/7311a6f898691af38a970e0cd25fd8df6617157c

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 30 2011