Skip to content

Commit 1ad5f31

Browse files
authored
[Clang] Avoid a crash when parsing an invalid pseudo-destructor (#111666)
Fixes #111460.
1 parent bda4fc0 commit 1ad5f31

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ Bug Fixes to C++ Support
481481
- Clang now uses the correct set of template argument lists when comparing the constraints of
482482
out-of-line definitions and member templates explicitly specialized for a given implicit instantiation of
483483
a class template. (#GH102320)
484+
- Fix a crash when parsing a pseudo destructor involving an invalid type. (#GH111460)
484485

485486
Bug Fixes to AST Handling
486487
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/Sema/SemaExprCXX.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8429,7 +8429,8 @@ ExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, Expr *Base,
84298429
QualType ObjectType;
84308430
QualType T;
84318431
TypeLocBuilder TLB;
8432-
if (CheckArrow(*this, ObjectType, Base, OpKind, OpLoc))
8432+
if (CheckArrow(*this, ObjectType, Base, OpKind, OpLoc) ||
8433+
DS.getTypeSpecType() == DeclSpec::TST_error)
84338434
return ExprError();
84348435

84358436
switch (DS.getTypeSpecType()) {

clang/test/Parser/cxx2c-pack-indexing.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,14 @@ struct base {
6363
int main() {
6464
SS<int, base>().f(0);
6565
}
66+
67+
68+
namespace GH11460 {
69+
template <typename... T>
70+
requires( ); // expected-error {{expected expression}}
71+
struct SS {
72+
void f( ) {
73+
(*p).~T...[](); // expected-error {{use of undeclared identifier 'p'}}
74+
}
75+
};
76+
}

0 commit comments

Comments
 (0)