// the member function body.
if (!BaseType->isDependentType() &&
!isThisOutsideMemberFunctionBody(BaseType) &&
- RequireCompleteType(OpLoc, BaseType, diag::err_incomplete_member_access))
- return ExprError();
+ RequireCompleteType(OpLoc, BaseType,
+ diag::err_incomplete_member_access)) {
+ return CreateRecoveryExpr(Base->getBeginLoc(), Base->getEndLoc(), {Base});
+ }
// C++ [basic.lookup.classref]p2:
// If the id-expression in a class member access (5.2.5) is an
foo->func(x);
}
+void AccessIncompleteClass() {
+ struct Forward;
+ Forward* ptr;
+ // CHECK: CallExpr {{.*}} '<dependent type>'
+ // CHECK-NEXT: `-CXXDependentScopeMemberExpr {{.*}} '<dependent type>'
+ // CHECK-NEXT: `-RecoveryExpr {{.*}} '<dependent type>' contains-errors
+ // CHECK-NEXT: `-DeclRefExpr {{.*}} 'Forward *'
+ ptr->method();
+}
+
struct Foo2 {
double func();
class ForwardClass;
#pragma omp declare reduction (xxx : U, S : bar(omp_in)) // expected-error {{non-const lvalue reference to type 'S<1>' cannot bind to a value of unrelated type 'U'}}
static void bar(S &x); // expected-note {{passing argument to parameter 'x' here}}
};
-// expected-warning@+2 {{extra tokens at the end of '#pragma omp declare reduction' are ignored}}
// expected-note@+1 {{in instantiation of template class 'S<1>' requested here}}
#pragma omp declare reduction (bar : S<1> : omp_out.foo(omp_in))