Skip to content

Commit b76f66e

Browse files
author
Matthew Gretton-Dann
committed
C++: Add test cases for constant initializers
Adds test cases for initialisation of constants which aren't simple zeros. Example: int x = int();
1 parent fb20cab commit b76f66e

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
int x = int();
3+
float y = float();
4+
double z = double();
5+
6+
/* This produces a getValueText() of 0 for R() in line 9, which is debatable. */
7+
struct R {};
8+
struct S {
9+
S() : S(R()) { }
10+
S(R) { }
11+
};
12+
S s;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
| constants.cpp:2:9:2:13 | 0 | int() |
2+
| constants.cpp:3:11:3:17 | 0.0 | float() |
3+
| constants.cpp:4:12:4:19 | 0.0 | double() |
4+
| constants.cpp:9:11:9:13 | 0 | 0 |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import cpp
2+
3+
from Expr e
4+
select e, e.getValueText()

0 commit comments

Comments
 (0)