Fix 'array is too large' warning

This commit is contained in:
Ryan Huffman 2016-04-13 11:28:54 -07:00
parent 6cbd31fa51
commit e563de9ef8

View file

@ -68,8 +68,15 @@ void outOfBoundsVectorCrash() {
void newFault() {
qDebug() << "About to crash inside new fault";
// Disable "array is too large" warning for clang. We are deliberately
// choosing a large number so that we will crash!
#pragma clang diagnostic push
#pragma clang diagnostic ignore "-Wbad-array-new-length"
// Force crash with large allocation
int* data = new int[std::numeric_limits<uint64_t>::max()];
#pragma clang diagnostic pop
// Use variable to suppress warning
data[0] = 0;
}