Merge pull request #2055 from matt-gretton-dann/cpp-439-test-cases

C++: Add test cases for constant initializers
This commit is contained in:
ian-semmle
2019-10-01 12:43:46 +01:00
committed by GitHub
3 changed files with 20 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
int x = int();
float y = float();
double z = double();
/* This produces a getValueText() of 0 for R() in line 9, which is debatable. */
struct R {};
struct S {
S() : S(R()) { }
S(R) { }
};
S s;

View File

@@ -0,0 +1,4 @@
| constants.cpp:2:9:2:13 | 0 | int() |
| constants.cpp:3:11:3:17 | 0.0 | float() |
| constants.cpp:4:12:4:19 | 0.0 | double() |
| constants.cpp:9:11:9:13 | 0 | 0 |

View File

@@ -0,0 +1,4 @@
import cpp
from Expr e
select e, e.getValueText()