Merge pull request #2141 from geoffw0/newtest

CPP: AV Rule 114 test cases
This commit is contained in:
Jonas Jensen
2019-10-17 09:28:10 +02:00
committed by GitHub
2 changed files with 18 additions and 0 deletions

View File

@@ -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 |

View File

@@ -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
}