HerrCai0907 updated this revision to Diff 519675. HerrCai0907 added a comment.
use nullpt as SizeExpr Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D149612/new/ https://reviews.llvm.org/D149612 Files: clang/docs/ReleaseNotes.rst clang/lib/Sema/SemaType.cpp clang/test/Sema/merge-decls.c Index: clang/test/Sema/merge-decls.c =================================================================== --- clang/test/Sema/merge-decls.c +++ clang/test/Sema/merge-decls.c @@ -91,3 +91,7 @@ int x[5]; test7_f(&x); // expected-warning {{incompatible pointer types passing 'int (*)[5]' to parameter of type 'int (*)[10]}} } + +char d; +char x[sizeof(d.data) == 8]; // expected-error {{member reference base type 'char' is not a structure or union}} +char x[sizeof(d.data) == 4]; // expected-error {{member reference base type 'char' is not a structure or union}} Index: clang/lib/Sema/SemaType.cpp =================================================================== --- clang/lib/Sema/SemaType.cpp +++ clang/lib/Sema/SemaType.cpp @@ -2579,7 +2579,13 @@ T = Context.getIncompleteArrayType(T, ASM, Quals); } } else if (ArraySize->isTypeDependent() || ArraySize->isValueDependent()) { - T = Context.getDependentSizedArrayType(T, ArraySize, ASM, Quals, Brackets); + if (getLangOpts().CPlusPlus) { + T = Context.getDependentSizedArrayType(T, ArraySize, ASM, Quals, + Brackets); + } else { + // DependentSizedArrayType cannot be handled by C + T = Context.getConstantArrayType(T, ConstVal, nullptr, ASM, Quals); + } } else { ExprResult R = checkArraySize(*this, ArraySize, ConstVal, VLADiag, VLAIsError); Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -369,6 +369,8 @@ (`#62207 <https://github.com/llvm/llvm-project/issues/62207>`_) - Fix lambdas and other anonymous function names not respecting ``-fdebug-prefix-map`` (`#62192 <https://github.com/llvm/llvm-project/issues/62192>`_) +- Fix crash when redefine variant with invalid type as another invalid type. + (`#62447 <https://github.com/llvm/llvm-project/issues/62447>`_) Bug Fixes to Compiler Builtins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Index: clang/test/Sema/merge-decls.c =================================================================== --- clang/test/Sema/merge-decls.c +++ clang/test/Sema/merge-decls.c @@ -91,3 +91,7 @@ int x[5]; test7_f(&x); // expected-warning {{incompatible pointer types passing 'int (*)[5]' to parameter of type 'int (*)[10]}} } + +char d; +char x[sizeof(d.data) == 8]; // expected-error {{member reference base type 'char' is not a structure or union}} +char x[sizeof(d.data) == 4]; // expected-error {{member reference base type 'char' is not a structure or union}} Index: clang/lib/Sema/SemaType.cpp =================================================================== --- clang/lib/Sema/SemaType.cpp +++ clang/lib/Sema/SemaType.cpp @@ -2579,7 +2579,13 @@ T = Context.getIncompleteArrayType(T, ASM, Quals); } } else if (ArraySize->isTypeDependent() || ArraySize->isValueDependent()) { - T = Context.getDependentSizedArrayType(T, ArraySize, ASM, Quals, Brackets); + if (getLangOpts().CPlusPlus) { + T = Context.getDependentSizedArrayType(T, ArraySize, ASM, Quals, + Brackets); + } else { + // DependentSizedArrayType cannot be handled by C + T = Context.getConstantArrayType(T, ConstVal, nullptr, ASM, Quals); + } } else { ExprResult R = checkArraySize(*this, ArraySize, ConstVal, VLADiag, VLAIsError); Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -369,6 +369,8 @@ (`#62207 <https://github.com/llvm/llvm-project/issues/62207>`_) - Fix lambdas and other anonymous function names not respecting ``-fdebug-prefix-map`` (`#62192 <https://github.com/llvm/llvm-project/issues/62192>`_) +- Fix crash when redefine variant with invalid type as another invalid type. + (`#62447 <https://github.com/llvm/llvm-project/issues/62447>`_) Bug Fixes to Compiler Builtins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits