FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cppfront/regression-tests/mixed-out-destruction.cpp2 at main · iopenstack/cppfront · GitHub
iopenstack
/
cppfront
Public
forked from
hsutter/cppfront
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cppfront
/
regression-tests
/
mixed-out-destruction.cpp2
Copy path
More file actions
More file actions
Latest commit
History
History
History
38 lines (32 loc) · 1.36 KB
Breadcrumbs
cppfront
/
regression-tests
/
mixed-out-destruction.cpp2
Copy path
File metadata and controls
38 lines (32 loc) · 1.36 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
#include <iostream>
struct X {
inline static int Xnum = 0;
int num;
X() : num{++Xnum} { std::cout << "+X " << num << "\n"; }
~X() { std::cout << "-X " << num << "\n"; }
X(const X& that) : num{that.num} { std::cout << "+X copy " << num << "\n"; }
void operator=(const X& that) { num = that.num; std::cout << "=X copy " << num << "\n"; }
};
auto throw_1() { throw 1; }
struct C {
std::string f;
C(std::string const& fn) : f{fn} { std::cout << "enter " << f << "\n"; }
~C() { std::cout << "exit " << f << "\n"; }
};
//-------------------------------------------------------
// 0x: Test one level of out and immediate throw
f00: () throws = { _:C="f00"; x: X; f01(out x); }
f01: (out x: X) throws = { _:C="f01"; x=(); throw_1(); }
//-------------------------------------------------------
// 1x: Test multiple levels of out and intermediate throw
f10: () throws = { _:C="f10"; x: X; f11(out x); }
f11: (out x: X) throws = { _:C="f11"; f12(out x); }
f12: (out x: X) throws = { _:C="f12"; f13(out x); throw_1(); }
f13: (out x: X) throws = { _:C="f13"; f14(out x); }
f14: (out x: X) throws = { _:C="f14"; x=(); }
int main() {
C c("main");
try { f00(); } catch (int) {}
std::cout << "\n";
try { f10(); } catch (int) {}
}
Back
|
FazBrowse Home
|
New Git URL