This revision was automatically updated to reflect the committed changes. Closed by commit rGf5b5426433c9: [clang] Fix a crash on CheckArgAlignment. (authored by hokein).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D102750/new/ https://reviews.llvm.org/D102750 Files: clang/lib/Sema/SemaChecking.cpp clang/test/SemaCXX/typo-correction-crash.cpp Index: clang/test/SemaCXX/typo-correction-crash.cpp =================================================================== --- clang/test/SemaCXX/typo-correction-crash.cpp +++ clang/test/SemaCXX/typo-correction-crash.cpp @@ -42,3 +42,12 @@ } }; } + +namespace NoCrashOnCheckArgAlignment { +template <typename a> void b(a &); +void test() { + for (auto file_data :b(files_db_data)); // expected-error {{use of undeclared identifier 'files_db_data'; did you mean 'file_data'?}} \ + // expected-note {{'file_data' declared here}} \ + // expected-error {{cannot use type 'void' as a range}} +} +} Index: clang/lib/Sema/SemaChecking.cpp =================================================================== --- clang/lib/Sema/SemaChecking.cpp +++ clang/lib/Sema/SemaChecking.cpp @@ -4571,7 +4571,8 @@ // Find expected alignment, and the actual alignment of the passed object. // getTypeAlignInChars requires complete types - if (ParamTy->isIncompleteType() || ArgTy->isIncompleteType()) + if (ParamTy->isIncompleteType() || ArgTy->isIncompleteType() || + ParamTy->isUndeducedType() || ArgTy->isUndeducedType()) return; CharUnits ParamAlign = Context.getTypeAlignInChars(ParamTy);
Index: clang/test/SemaCXX/typo-correction-crash.cpp =================================================================== --- clang/test/SemaCXX/typo-correction-crash.cpp +++ clang/test/SemaCXX/typo-correction-crash.cpp @@ -42,3 +42,12 @@ } }; } + +namespace NoCrashOnCheckArgAlignment { +template <typename a> void b(a &); +void test() { + for (auto file_data :b(files_db_data)); // expected-error {{use of undeclared identifier 'files_db_data'; did you mean 'file_data'?}} \ + // expected-note {{'file_data' declared here}} \ + // expected-error {{cannot use type 'void' as a range}} +} +} Index: clang/lib/Sema/SemaChecking.cpp =================================================================== --- clang/lib/Sema/SemaChecking.cpp +++ clang/lib/Sema/SemaChecking.cpp @@ -4571,7 +4571,8 @@ // Find expected alignment, and the actual alignment of the passed object. // getTypeAlignInChars requires complete types - if (ParamTy->isIncompleteType() || ArgTy->isIncompleteType()) + if (ParamTy->isIncompleteType() || ArgTy->isIncompleteType() || + ParamTy->isUndeducedType() || ArgTy->isUndeducedType()) return; CharUnits ParamAlign = Context.getTypeAlignInChars(ParamTy);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits