Skip to content
Open
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
2 changes: 2 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,8 @@ Bug Fixes to C++ Support
- Fix a crash when parsing a pseudo destructor involving an invalid type. (#GH111460)
- Fixed an assertion failure when invoking recovery call expressions with explicit attributes
and undeclared templates. (#GH107047, #GH49093)
- Fixed a compiler crash that occurred when processing malformed code involving `sizeof` with
an invalid type argument. (#GH111594)

Bug Fixes to AST Handling
^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
3 changes: 3 additions & 0 deletions clang/lib/Sema/SemaExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4629,6 +4629,9 @@ ExprResult Sema::CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo,
TInfo->getType()->isVariablyModifiedType())
TInfo = TransformToPotentiallyEvaluated(TInfo);

if (!TInfo)
return ExprError();

// C99 6.5.3.4p4: the type (an unsigned integer type) is size_t.
return new (Context) UnaryExprOrTypeTraitExpr(
ExprKind, TInfo, Context.getSizeType(), OpLoc, R.getEnd());
Expand Down
11 changes: 11 additions & 0 deletions clang/test/SemaCXX/unary-expr-or-type-trait-invalid.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-value %s
//
// Note: This test is ensure the code does not cause a crash as previously
// reported in (#GH111594). The specific diagnostics are unimportant.

a() {struct b c (sizeof(b * [({ {tree->d* next)} 0

// expected-error@6 0+{{}}
// expected-error@11 0+{{}}
// expected-note@6 0+{{}}

Loading