Skip to content

Commit 2ba0f19

Browse files
shashforgecor3ntin
andauthored
Apply suggestions from code review
Adding review comment Co-authored-by: Corentin Jabot <[email protected]>
1 parent a3915ed commit 2ba0f19

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ Bug Fixes to C++ Support
923923
- Improved handling of variables with ``consteval`` constructors, to
924924
consistently treat the initializer as manifestly constant-evaluated.
925925
(#GH135281)
926-
- Switch `ParseBaseClause` to use `BaseResult::isUsable()` instead of `isInvalid()`, fixing dropped or mis-parsed base specifiers in C++ classes. (#GH147186)
926+
- Fix a crash in the presence of invalid base classes. (#GH147186)
927927

928928
Bug Fixes to AST Handling
929929
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/Parse/ParseDeclCXX.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2252,9 +2252,6 @@ void Parser::ParseBaseClause(Decl *ClassDecl) {
22522252
while (true) {
22532253
// Parse a base-specifier.
22542254
BaseResult Result = ParseBaseSpecifier(ClassDecl);
2255-
// Skip any base-specifier we couldn’t actually build into a usable
2256-
// CXXBaseSpecifier (covers both syntactic invalidity and
2257-
// other un-usable cases).
22582255
if (!Result.isUsable()) {
22592256
// Skip the rest of this base specifier, up until the comma or
22602257
// opening brace.

clang/test/SemaCXX/invalid-base-inheritance.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Tests that invalid base-specifiers no longer crash the compiler.
22
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
33

4+
namespace GH147186 {
5+
46
class X; // expected-note {{forward declaration of 'X'}} expected-note {{forward declaration of 'X'}}
57

68
class A : X { // expected-error {{base class has incomplete type}}
@@ -11,3 +13,4 @@ class Y : int { // expected-error {{expected class name}}
1113

1214
class Z : X*, virtual int { // expected-error {{base class has incomplete type}} expected-error {{expected class name}}
1315
};
16+
}

0 commit comments

Comments
 (0)