libc++ patch for LWG Issue 2232 - dangling reference for regex_iterators
Marshall Clow
mclow.lists at gmail.com
Fri Feb 14 16:21:30 PST 2014
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LWG2332.patch
Type: application/octet-stream
Size: 11462 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140214/50ce4ac0/attachment.obj>
More information about the cfe-commits
mailing list