llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Osama Abdelkader (osamakader) <details> <summary>Changes</summary> Guard hasTagDefinition() against invalid type-specifier state so recovery from invalid auto/tag combinations does not assert. Fixes #<!-- -->210014 --- Full diff: https://github.com/llvm/llvm-project/pull/210085.diff 2 Files Affected: - (modified) clang/lib/Sema/DeclSpec.cpp (+1-1) - (modified) clang/test/SemaCXX/auto-cxx0x.cpp (+3) ``````````diff diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp index 4d20657d5e517..9df12d0c4ce75 100644 --- a/clang/lib/Sema/DeclSpec.cpp +++ b/clang/lib/Sema/DeclSpec.cpp @@ -431,7 +431,7 @@ void DeclSpec::forEachQualifier( } bool DeclSpec::hasTagDefinition() const { - if (!TypeSpecOwned) + if (!TypeSpecOwned || !isDeclRep((TST)TypeSpecType)) return false; return cast<TagDecl>(getRepAsDecl())->isCompleteDefinition(); } diff --git a/clang/test/SemaCXX/auto-cxx0x.cpp b/clang/test/SemaCXX/auto-cxx0x.cpp index fa953f35723ef..ff2c98fce7523 100644 --- a/clang/test/SemaCXX/auto-cxx0x.cpp +++ b/clang/test/SemaCXX/auto-cxx0x.cpp @@ -14,6 +14,9 @@ void f() { struct PR209000 { } auto; // expected-error {{'auto' cannot be combined with a type specifier}} +auto union { // expected-error {{cannot combine with previous 'auto' declaration specifier}} +} foo<>; // expected-error {{no template named 'foo'}} + typedef auto PR25449(); // expected-error {{'auto' not allowed in typedef}} thread_local auto x; // expected-error {{requires an initializer}} `````````` </details> https://github.com/llvm/llvm-project/pull/210085 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
