mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
C++: Add a testcase that demonstrates the problem with MaD and typedefs.
This commit is contained in:
@@ -218,3 +218,15 @@ sourceCallables
|
||||
| tests.cpp:441:6:441:17 | dontUseValue |
|
||||
| tests.cpp:441:23:441:23 | x |
|
||||
| tests.cpp:443:6:443:27 | test_function_pointers |
|
||||
| tests.cpp:456:19:456:19 | X |
|
||||
| tests.cpp:457:8:457:35 | StructWithTypedefInParameter<X> |
|
||||
| tests.cpp:457:8:457:35 | StructWithTypedefInParameter<int> |
|
||||
| tests.cpp:458:12:458:15 | Type |
|
||||
| tests.cpp:459:5:459:31 | parameter_ref_to_return_ref |
|
||||
| tests.cpp:459:5:459:31 | parameter_ref_to_return_ref |
|
||||
| tests.cpp:459:45:459:45 | x |
|
||||
| tests.cpp:459:45:459:45 | x |
|
||||
| tests.cpp:462:6:462:37 | test_parameter_ref_to_return_ref |
|
||||
| tests.cpp:463:6:463:6 | x |
|
||||
| tests.cpp:464:36:464:36 | s |
|
||||
| tests.cpp:465:6:465:6 | y |
|
||||
|
||||
@@ -98,6 +98,7 @@ private class TestSummaries extends SummaryModelCsv {
|
||||
";;false;madCallArg0ReturnToReturnFirst;;;Argument[0].ReturnValue;ReturnValue.Field[first];value",
|
||||
";;false;madCallArg0WithValue;;;Argument[1];Argument[0].Parameter[0];value",
|
||||
";;false;madCallReturnValueIgnoreFunction;;;Argument[1];ReturnValue;value",
|
||||
";StructWithTypedefInParameter<T>;true;parameter_ref_to_return_ref;(const T &);;Argument[*0];ReturnValue[*];value"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,3 +452,16 @@ void test_function_pointers() {
|
||||
madCallReturnValueIgnoreFunction(&sink, source());
|
||||
sink(madCallReturnValueIgnoreFunction(&dontUseValue, source())); // $ ir
|
||||
}
|
||||
|
||||
template<typename X>
|
||||
struct StructWithTypedefInParameter {
|
||||
typedef X Type;
|
||||
X& parameter_ref_to_return_ref(const Type& x); // $ MISSING: interpretElement
|
||||
};
|
||||
|
||||
void test_parameter_ref_to_return_ref() {
|
||||
int x = source();
|
||||
StructWithTypedefInParameter<int> s;
|
||||
int y = s.parameter_ref_to_return_ref(x);
|
||||
sink(y); // $ MISSING: ir
|
||||
}
|
||||
Reference in New Issue
Block a user