File tree Expand file tree Collapse file tree 3 files changed +51
-10
lines changed Expand file tree Collapse file tree 3 files changed +51
-10
lines changed Original file line number Diff line number Diff line change 798
798
T const ^ operator ->(self const ^) noexcept safe {
799
799
return ^*self->p_ ->data_ .get ();
800
800
}
801
+
802
+ T const ^ operator *(self const ^) noexcept safe {
803
+ return ^*self->p_ ->data_ .get ();
804
+ }
801
805
};
802
806
803
807
// //////////////////////////////////////////////////////////////////////////////
Original file line number Diff line number Diff line change 3
3
#include < std2.h>
4
4
#include " lightweight_test.h"
5
5
6
+ struct anon_callable /(a, b, c)
7
+ {
8
+ std2::string_view/c sv_;
9
+ int ^/a x_;
10
+ int const ^/b y_;
11
+
12
+ anon_callable (
13
+ std2::string_view/c sv,
14
+ int ^/a x,
15
+ int const ^/b y) safe
16
+ : sv_ (sv)
17
+ , x_ (x)
18
+ , y_ (y)
19
+ {
20
+ }
21
+
22
+ [[unsafe::drop_only (a, b)]]
23
+ ~anon_callable () = default ;
24
+
25
+ void operator ()(self const ^) safe
26
+ {
27
+ self->sv_ ;
28
+ self->x_ ;
29
+ self->y_ ;
30
+ }
31
+ };
32
+
33
+ void functor_test () safe
34
+ {
35
+ std2::string_view sv = " hello, world!" sv2;
36
+
37
+ int a = 1234 ;
38
+ int const b = 4321 ;
39
+
40
+ anon_callable f (sv, ^a, b);
41
+ f ();
42
+ }
43
+
6
44
void drop_only () safe
7
45
{
8
46
{
@@ -11,10 +49,10 @@ void drop_only() safe
11
49
std2::string s (" hello, world!" );
12
50
13
51
// TODO: re-enable this test once we get pointer variance working
14
- // p = std2::arc(s.str());
15
- // assert_true (*p == "hello, world!"sv2);
52
+ p = std2::arc (s.str ());
53
+ REQUIRE_EQ (*p, " hello, world!" sv2);
16
54
}
17
55
}
18
56
}
19
57
20
- TEST_MAIN (drop_only)
58
+ TEST_MAIN (functor_test, drop_only)
Original file line number Diff line number Diff line change @@ -37,14 +37,13 @@ void drop_only() safe
37
37
std2::string s (" hello, world!" );
38
38
39
39
// TODO: re-enable this test once we get pointer variance working
40
- // p = std2::rc(s.str());
41
- // REQUIRE(*p == "hello, world!"sv2);
40
+ p = std2::rc (s.str ());
41
+ REQUIRE (*p == " hello, world!" sv2);
42
42
}
43
43
}
44
44
}
45
45
46
- int main () safe
47
- {
48
- rc_constructor ();
49
- drop_only ();
50
- }
46
+ TEST_MAIN (
47
+ rc_constructor,
48
+ drop_only
49
+ )
You can’t perform that action at this time.
0 commit comments