#include <tuple>
int UnsafeIndex();
void fct() {
int buffer[]{1, 2};
void* void_ptr = buffer;
int* ptr = static_cast<int*>(void_ptr);
std::ignore = ptr[UnsafeIndex()];
}
void my_func(void* void_ptr) {
int* ptr = static_cast<int*>(void_ptr);
std::ignore = ptr[UnsafeIndex()];
}
void fct2() {
int buffer[]{1, 2};
my_func(buffer);
}
struct MyStruct {
void* void_ptr;
};
void fct4() {
int buffer[]{1, 2};
MyStruct my_struct;
my_struct.void_ptr = buffer;
int* ptr = static_cast<int*>(my_struct.void_ptr);
std::ignore = ptr[UnsafeIndex()];
}