Bug 18167 – std.array.appender should be usable in @safe

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2018-01-03T03:13:33Z
Last change time
2021-11-01T17:12:44Z
Assigned to
No Owner
Creator
Seb
Blocks
18110

Comments

Comment #0 by greensunny12 — 2018-01-03T03:13:33Z
void test @safe { import std.array; struct S { void opAssign(S) { } } auto a1 = Appender!(const(S)[])(); auto s1 = const(S)(); a1.put(s1); } onlineapp.d(14): Error: @safe function 'onlineapp.test' cannot call @system function 'std.array.Appender!(const(S)[]).Appender.put!(const(S)).put'
Comment #1 by greensunny12 — 2018-01-03T03:15:30Z
Another example: void test @safe { static class A {} auto w = appender!(shared(A)[])(); w.put(new shared A()); }
Comment #2 by Ajieskola — 2021-11-01T17:12:44Z
Both of these examples compile with self-built DMD v2.098.0-132-ge26dfa84d, after adding function parenthesis and an import to the latter example. Both still failed with DMD v2.095.1. Assuming fixed.