smanna12 wrote: ``` if (Init && !Init->getType().isNull() && 13716 !Init->getType()->isDependentType() && !VDeclType->isDependentType() && 13717 Context.getAsIncompleteArrayType(VDeclType) && 13718 Context.getAsIncompleteArrayType(Init->getType())) { 13719 // Bail out if it is not possible to deduce array size from the 13720 // initializer. 13721 Diag(VDecl->getLocation(), diag::err_typecheck_decl_incomplete_type) 13722 << VDeclType; 13723 VDecl->setInvalidDecl(); 13724 return; 13725 }
``` Removing null check of ` Init ` would cause segfault for the test case`test/SemaCXX/paren-list-agg-init.cpp` when we try to access a member function (getType()) on a null pointer (Init) ``` int arr6[n](1, 2, 3); // expected-warning {{variable length arrays in C++ are a Clang extension}} \ expected-note {{function parameter 'n' with unknown value cannot be used in a constant expression}} \ expected-error {{variable-sized object may not be initialized}} ``` https://github.com/llvm/llvm-project/pull/94368 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits