libc++ patch for LWG Issue 2232 - dangling reference for regex_iterators

David Blaikie dblaikie at gmail.com
Fri Feb 14 16:31:46 PST 2014


Would this break (what I assume is) correct code doing things like:

std::find(sregex_iterator(s.begin(), s.end(), regex("meow")), end, "foo");

?


On Fri, Feb 14, 2014 at 4:21 PM, Marshall Clow <mclow.lists at gmail.com>wrote:

> Users can write
>         for(sregex_iterator i(s.begin(), s.end(), regex("meow")), end; i
> != end; ++i)
>
> binding a temporary regex to const regex& and storing a pointer to it.
> This will compile silently, triggering undefined behavior at runtime.
>
> Fixing this involves defining constructors for the various regex iterator
> types from rvalue regexes, and then marking them as "deleted".
> And tests.
>
> -- Marshall
>
> Marshall Clow     Idio Software   <mailto:mclow.lists at gmail.com>
>
> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is
> promptly moderated down to (-1, Flamebait).
>         -- Yu Suzuki
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140214/88f350e7/attachment.html>


More information about the cfe-commits mailing list