Skip to content

[clang] fix(85447): clang 18.1.0 crashes in clang::ASTContext::getTypeInfoImpl #89850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ Bug Fixes to C++ Support
- Fix a bug on template partial specialization with issue on deduction of nontype template parameter
whose type is `decltype(auto)`. Fixes (#GH68885).
- Clang now correctly treats the noexcept-specifier of a friend function to be a complete-class context.
- Fix an assertion failure when parsing an invalid members of an anonymous class. (#GH85447)

Bug Fixes to AST Handling
^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
3 changes: 3 additions & 0 deletions clang/lib/Sema/SemaDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5790,6 +5790,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
Anon = VarDecl::Create(Context, Owner, DS.getBeginLoc(),
Record->getLocation(), /*IdentifierInfo=*/nullptr,
Context.getTypeDeclType(Record), TInfo, SC);
if (Invalid)
Anon->setInvalidDecl();

ProcessDeclAttributes(S, Anon, Dc);

// Default-initialize the implicit variable. This initialization will be
Expand Down
10 changes: 10 additions & 0 deletions clang/test/Sema/incomplete-struct-decl.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: %clang_cc1 -x c++ -fsyntax-only -verify=cxx,expected %s

template <class a> using __impl_of = a; // expected-note {{'__impl_of' declared here}} \
expected-note {{template is declared here}}
struct { // expected-error {{anonymous structs and classes must be class members}} \
expected-note {{to match this '{'}}
__impl_; // expected-error {{no template named '__impl_'; did you mean '__impl_of'?}} \
expected-error {{cannot specify deduction guide for alias template '__impl_of'}} \
expected-error {{expected ';' after struct}}
// expected-error {{expected '}'}}
Loading