mirror of
https://github.com/github/codeql.git
synced 2026-04-22 15:25:18 +02:00
C++: Add test to check lambda parameters emptyness
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
| parameters.cpp:8:5:8:20 | [...](...){...} |
|
||||
| parameters.cpp:10:5:10:26 | [...](...){...} |
|
||||
| parameters.cpp:13:5:13:20 | [...](...){...} |
|
||||
| parameters.cpp:16:5:18:5 | [...](...){...} |
|
||||
| parameters.cpp:25:5:25:14 | [...](...){...} |
|
||||
@@ -0,0 +1,5 @@
|
||||
import cpp
|
||||
|
||||
from LambdaExpression e
|
||||
where e.emptyParameterListIsExplicit()
|
||||
select e
|
||||
26
cpp/ql/test/library-tests/lambdas/syntax/parameters.cpp
Normal file
26
cpp/ql/test/library-tests/lambdas/syntax/parameters.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
void test_lambda_declarator() {
|
||||
[=](int, float) { };
|
||||
|
||||
[](int x = 42) { };
|
||||
|
||||
[](int x) { };
|
||||
|
||||
[]() mutable { };
|
||||
|
||||
[]() [[nodiscard]] { };
|
||||
[] [[nodiscard]] { };
|
||||
|
||||
[]() -> void { };
|
||||
|
||||
int i;
|
||||
[&i]() {
|
||||
i += 1;
|
||||
};
|
||||
|
||||
[&i] {
|
||||
i += 1;
|
||||
};
|
||||
|
||||
[] { };
|
||||
[=] () { };
|
||||
}
|
||||
Reference in New Issue
Block a user