File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
cpp/ql/test/library-tests/variables/getanassignedvalue Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ | file://:0:0:0:0 | abc | test.cpp:53:6:53:11 | chars1 |
2+ | file://:0:0:0:0 | {...} | test.cpp:38:22:38:22 | v |
13| test.cpp:4:9:4:11 | 10 | test.cpp:4:6:4:6 | v |
24| test.cpp:5:15:5:16 | & ... | test.cpp:5:7:5:11 | ptr_v |
35| test.cpp:6:15:6:15 | v | test.cpp:6:7:6:11 | ref_v |
810| test.cpp:19:42:19:43 | _x | test.cpp:24:8:24:8 | x |
911| test.cpp:19:49:19:50 | _y | test.cpp:24:11:24:11 | y |
1012| test.cpp:19:54:19:60 | 0.0 | test.cpp:24:14:24:14 | z |
13+ | test.cpp:35:16:35:25 | {...} | test.cpp:35:11:35:12 | v1 |
14+ | test.cpp:36:16:36:39 | {...} | test.cpp:36:11:36:12 | v2 |
15+ | test.cpp:48:16:48:28 | {...} | test.cpp:48:11:48:12 | v3 |
16+ | test.cpp:52:19:52:27 | {...} | test.cpp:52:5:52:11 | myArray |
17+ | test.cpp:54:17:54:31 | {...} | test.cpp:54:6:54:11 | chars2 |
18+ | test.cpp:55:16:55:20 | abc | test.cpp:55:7:55:12 | chars3 |
Original file line number Diff line number Diff line change @@ -23,3 +23,33 @@ class myClass1
2323private:
2424 float x, y, z;
2525};
26+
27+ // ---
28+
29+ struct myStruct1
30+ {
31+ int num;
32+ const char *str;
33+ };
34+
35+ myStruct1 v1 = {1 , " One" }; // assigment to `v1`
36+ myStruct1 v2 = {.num = 2 , .str = " Two" }; // assigment to `v2`
37+
38+ void test2 (myStruct1 v = {3 , " Three" }) // assignment to `v` (literal `{...}` has no location)
39+ {
40+ // ...
41+ }
42+
43+ struct myStruct2
44+ {
45+ myStruct1 ms2;
46+ };
47+
48+ myStruct2 v3 = {{4 , " Four" }}; // assigment to `v3`
49+
50+ // ---
51+
52+ int myArray[10 ] = {1 , 2 , 3 }; // assigment to `myArray`
53+ char chars1[] = " abc" ; // assignment to `chars1` (literal "abc" has no location)
54+ char chars2[] = {' a' , ' b' , ' c' }; // assigment to `chars2`
55+ char *chars3 = " abc" ; // assigment to `chars3`
You can’t perform that action at this time.
0 commit comments