[Issue 14136] New: std.uni.utfMatcher breaks @safety
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Feb 6 16:44:31 PST 2015
https://issues.dlang.org/show_bug.cgi?id=14136
Issue ID: 14136
Summary: std.uni.utfMatcher breaks @safety
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Keywords: safe
Severity: enhancement
Priority: P1
Component: Phobos
Assignee: nobody at puremagic.com
Reporter: code at klickverbot.at
---
struct Oops {
pure:
bool empty() {
*cast(int*)0xcafebabe = 0xdeadbeef;
return true;
}
Oops save() @property { return this; }
char front;
void popFront() {}
char back;
void popBack() {}
ref char opIndex(size_t idx) { return front; }
enum size_t length = 0;
alias opDollar = length;
}
void main() @safe {
import std.uni;
auto m = utfMatcher!char(unicode.Number);
Oops o;
m.match(o);
}
---
Again, the reason is a @trusted template function taking an arbitrary range.
Source permalink (other match variants are affected too):
https://github.com/D-Programming-Language/phobos/blob/041db2d8fac2b1cf5169be7188ea537a01f27586/std/uni.d#L4767-L4787
Introduced in https://github.com/D-Programming-Language/phobos/pull/2020.
--
More information about the Digitalmars-d-bugs
mailing list