1 module ut.issues;
2 
3 
4 import ut;
5 import automem;
6 
7 
8 private typeof(vector(1).range()) gVectorIntRange;
9 
10 version(AutomemAsan) {}
11 else {
12 
13     @ShouldFail("https://issues.dlang.org/show_bug.cgi?id=19752")
14     @("26")
15     @safe unittest {
16         static void escape() {
17             auto vec = vector(1, 2, 3);
18             gVectorIntRange = vec.range;
19         }
20 
21         static void stackSmash() {
22             long[4096] arr = 42;
23         }
24 
25         escape;
26         gVectorIntRange.length.should == 0;
27         stackSmash;
28         gVectorIntRange.length.should == 0;
29     }
30 }
31 
32 
33 @("27")
34 @safe unittest {
35     const str = String("foobar");
36 
37     (str == "foobar").should == true;
38     (str == "barfoo").should == false;
39     (str == "quux").should == false;
40 
41     (str == String("foobar")).should == true;
42     (str == String("barfoo")).should == false;
43     (str == String("quux")).should == false;
44 }
45 
46 
47 @("37")
48 @safe unittest {
49 
50     static struct S {
51         int front;
52         void popFront() { ++front; }
53         @property bool empty() { return front >= 10; }
54     }
55 
56     auto rc = RefCounted!S(0);
57     foreach(i; *rc) {}
58 
59     auto un = Unique!S(0);
60     foreach(i; *un) {}
61 }
62 
63 
64 @("38")
65 @safe unittest {
66 
67     import core.exception: AssertError;
68 
69     static struct S {
70         int front = 0;
71     }
72 
73     auto rc = RefCounted!S();
74     rc.front.shouldThrow!AssertError;
75 }