FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cppfront/pure2-assert-shared-ptr-not-null.cpp at main · jnorthrup/cppfront · GitHub
jnorthrup
/
cppfront
Public
forked from
hsutter/cppfront
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
8
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cppfront
/
pure2-assert-shared-ptr-not-null.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
52 lines (34 loc) · 1.61 KB
Breadcrumbs
cppfront
/
pure2-assert-shared-ptr-not-null.cpp
Copy path
File metadata and controls
52 lines (34 loc) · 1.61 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
=== Cpp2 type declarations ====================================================
#
include
"
cpp2util.h
"
#
line
1 "regression-tests/pure2-assert-shared-ptr-not-null.cpp2"
//
=== Cpp2 type definitions and function declarations ===========================
#
line
1 "regression-tests/pure2-assert-shared-ptr-not-null.cpp2"
#
line
2 "regression-tests/pure2-assert-shared-ptr-not-null.cpp2"
[[nodiscard]]
auto
fine
() -> int;
#
line
11 "regression-tests/pure2-assert-shared-ptr-not-null.cpp2"
[[nodiscard]]
auto
bad_shared_ptr_access
() -> int;
#
line
18 "regression-tests/pure2-assert-shared-ptr-not-null.cpp2"
[[nodiscard]]
auto
main
() -> int;
//
=== Cpp2 function definitions =================================================
#
line
1 "regression-tests/pure2-assert-shared-ptr-not-null.cpp2"
#
line
2 "regression-tests/pure2-assert-shared-ptr-not-null.cpp2"
[[nodiscard]]
auto
fine
() -> int
{
auto
up {
CPP2_UFCS_TEMPLATE
(cpp2_new<
int
>)(cpp2::unique,
1
)};
auto
sp {
CPP2_UFCS_TEMPLATE
(cpp2_new<
int
>)(cpp2::shared,
2
)};
std::optional<
int
> op {
3
};
return
*
cpp2::impl::assert_not_null
(
cpp2::move
(up)) + *
cpp2::impl::assert_not_null
(
cpp2::move
(sp)) + *
cpp2::impl::assert_not_null
(
cpp2::move
(op));
}
#
line
11 "regression-tests/pure2-assert-shared-ptr-not-null.cpp2"
[[nodiscard]]
auto
bad_shared_ptr_access
() -> int
{
auto
sp {std::make_shared<
int
>(
1
)};
CPP2_UFCS
(reset)(sp);
return
*
cpp2::impl::assert_not_null
(
cpp2::move
(sp));
}
#
line
18 "regression-tests/pure2-assert-shared-ptr-not-null.cpp2"
[[nodiscard]]
auto
main
() -> int
{
std::set_terminate
(std::abort);
return
fine
() +
bad_shared_ptr_access
();
}
Back
|
FazBrowse Home
|
New Git URL