Thread overview
[Issue 6261] New: [2.054 beta regression] Regex cannot take a char[]
Jul 06, 2011
Jesse Phillips
Jul 06, 2011
Dmitry Olshansky
Jul 06, 2011
Jesse Phillips
Jul 06, 2011
Dmitry Olshansky
Jul 30, 2011
Dmitry Olshansky
Jul 30, 2011
Dmitry Olshansky
July 06, 2011
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


--- Comment #0 from Jesse Phillips <Jesse.K.Phillips+D@gmail.com> 2011-07-06 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: -------
July 06, 2011
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


--- Comment #1 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2011-07-06 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: -------
July 06, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6261



--- Comment #2 from Jesse Phillips <Jesse.K.Phillips+D@gmail.com> 2011-07-06 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: -------
July 06, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6261


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

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


--- Comment #3 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2011-07-06 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: -------
July 30, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6261


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

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


--- Comment #4 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2011-07-30 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: -------
July 30, 2011
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


--- Comment #5 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2011-07-30 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: -------