C++: Add a test that demonstrates reference dereference duplication.

This commit is contained in:
Mathias Vorreiter Pedersen
2023-11-16 10:50:01 +00:00
parent f8feb84958
commit 799873113f
3 changed files with 16 additions and 0 deletions

View File

@@ -836,4 +836,14 @@ namespace MoreGlobalTests {
sink(global_direct); // $ ir MISSING: ast
indirect_sink(global_direct); // clean
}
}
void test_references() {
int x = source();
int &y = x;
sink(y); // $ ast,ir
int* px = indirect_source();
int*& rpx = px;
indirect_sink((int*)rpx); // $ ast,ir
}