hokein created this revision. hokein added a reviewer: sammccall. Herald added a project: clang.
Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D79009 Files: clang/lib/Sema/SemaExprCXX.cpp clang/test/AST/ast-dump-recovery.cpp Index: clang/test/AST/ast-dump-recovery.cpp =================================================================== --- clang/test/AST/ast-dump-recovery.cpp +++ clang/test/AST/ast-dump-recovery.cpp @@ -104,6 +104,16 @@ // CHECK-NEXT:| `-UnresolvedLookupExpr {{.*}} 'invalid' struct alignas(invalid()) Aligned {}; +struct Incomplete; +Incomplete make_incomplete(); +// CHECK: FunctionDecl {{.*}} test2 +// CHECK-NEXT: `-CompoundStmt +// CHECK-NEXT: `-RecoveryExpr {{.*}} contains-errors +// CHECK-NEXT: `-UnresolvedLookupExpr {{.*}} 'make_incomplete' +void test2() { + make_incomplete(); +} + void InvalidInitalizer(int x) { struct Bar { Bar(); }; // CHECK: `-VarDecl {{.*}} a1 'Bar' Index: clang/lib/Sema/SemaExprCXX.cpp =================================================================== --- clang/lib/Sema/SemaExprCXX.cpp +++ clang/lib/Sema/SemaExprCXX.cpp @@ -7219,8 +7219,11 @@ // the member function body. if (!BaseType->isDependentType() && !isThisOutsideMemberFunctionBody(BaseType) && - RequireCompleteType(OpLoc, BaseType, diag::err_incomplete_member_access)) + RequireCompleteType(OpLoc, BaseType, diag::err_incomplete_member_access)) { + if (Base->containsErrors()) + return Base; return ExprError(); + } // C++ [basic.lookup.classref]p2: // If the id-expression in a class member access (5.2.5) is an
Index: clang/test/AST/ast-dump-recovery.cpp =================================================================== --- clang/test/AST/ast-dump-recovery.cpp +++ clang/test/AST/ast-dump-recovery.cpp @@ -104,6 +104,16 @@ // CHECK-NEXT:| `-UnresolvedLookupExpr {{.*}} 'invalid' struct alignas(invalid()) Aligned {}; +struct Incomplete; +Incomplete make_incomplete(); +// CHECK: FunctionDecl {{.*}} test2 +// CHECK-NEXT: `-CompoundStmt +// CHECK-NEXT: `-RecoveryExpr {{.*}} contains-errors +// CHECK-NEXT: `-UnresolvedLookupExpr {{.*}} 'make_incomplete' +void test2() { + make_incomplete(); +} + void InvalidInitalizer(int x) { struct Bar { Bar(); }; // CHECK: `-VarDecl {{.*}} a1 'Bar' Index: clang/lib/Sema/SemaExprCXX.cpp =================================================================== --- clang/lib/Sema/SemaExprCXX.cpp +++ clang/lib/Sema/SemaExprCXX.cpp @@ -7219,8 +7219,11 @@ // the member function body. if (!BaseType->isDependentType() && !isThisOutsideMemberFunctionBody(BaseType) && - RequireCompleteType(OpLoc, BaseType, diag::err_incomplete_member_access)) + RequireCompleteType(OpLoc, BaseType, diag::err_incomplete_member_access)) { + if (Base->containsErrors()) + return Base; return ExprError(); + } // C++ [basic.lookup.classref]p2: // If the id-expression in a class member access (5.2.5) is an
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits