Paulo Matos 968be05b8f [clang] Fix crash for sizeof on VLAs
Adds overload of TransformToPotentiallyEvaluated for TypeSourceInfo to
properly deal with VLAs in nested calls of sizeof and typeof. Fixes
PR31042 (https://github.com/llvm/llvm-project/issues/30390).

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D27800
2022-01-12 16:10:58 +01:00

11 lines
314 B
C++

// RUN: %clang_cc1 -o - -emit-llvm -triple x86_64-unknown-linux-gnu -disable-free %s
// We need to use -emit-llvm in order to trigger the error, without it semantic analysis
// does not verify the used bit and there's no error.
char a[1];
void f1(void) {
int i = 0;
int j = sizeof(typeof(*(char(*)[i])a));
}