mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge pull request #2141 from geoffw0/newtest
CPP: AV Rule 114 test cases
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
| complex.c:3:2:3:45 | declaration | Function complexTest1 should return a value of type _Complex double but does not return a value here |
|
||||
| complex.c:7:2:7:41 | declaration | Function complexTest2 should return a value of type _Complex double but does not return a value here |
|
||||
| test.c:8:5:8:14 | declaration | Function f2 should return a value of type int but does not return a value here |
|
||||
| test.c:25:9:25:14 | ExprStmt | Function f4 should return a value of type int but does not return a value here |
|
||||
| test.c:39:9:39:14 | ExprStmt | Function f6 should return a value of type int but does not return a value here |
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
_Complex double complexTest1(float a, float b) {
|
||||
_Complex double x = __builtin_complex(a, b); // BAD
|
||||
}
|
||||
|
||||
_Complex double complexTest2(float a, float b) {
|
||||
auto x = __builtin_complex(a, b) * 2.0f; // BAD
|
||||
}
|
||||
|
||||
_Complex double complexTest3(float a, float b) {
|
||||
return __builtin_complex(a, b); // GOOD
|
||||
}
|
||||
|
||||
auto complexTest4(float a, float b) {
|
||||
return __builtin_complex(a, b) * 2.0f; // GOOD
|
||||
}
|
||||
Reference in New Issue
Block a user