[clang] Fix crash with invalid VLA in a type trait (PR #138543)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Fri May 9 22:51:19 PDT 2025


================
@@ -41,3 +41,17 @@ void func(int expr) {
   int array[sizeof(Ty) ? sizeof(Ty{}) : sizeof(int)];
   int old_style_assert[expr ? Ty::one : Ty::Neg_one]; // We don't diagnose as a VLA until instantiation
 }
+
+namespace GH138444 {
+struct S {         // expected-note {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const S &' for 1st argument}} \
----------------
shafik wrote:

I would have liked to see a test for the union case as well since it also triggered the crash. I don't see a way to trigger it w/ the enum case yet. 

https://github.com/llvm/llvm-project/pull/138543


More information about the cfe-commits mailing list