C++: Add a testcase that demonstrates the problem with MaD and typedefs.

This commit is contained in:
Mathias Vorreiter Pedersen
2025-01-02 11:10:13 +01:00
parent f23e56bdca
commit 5ccc12cea1
3 changed files with 26 additions and 0 deletions

View File

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

View File

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

View File

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