forked from OSchip/llvm-project
Fix a C struct diagnostic regression introduced by r187504 (PR17762).
llvm-svn: 193799
This commit is contained in:
parent
77ada678ed
commit
bd6ddaa0e7
|
@ -1158,6 +1158,11 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
|
|||
// overloaded operator->, but that should have been dealt with
|
||||
// by now--or a diagnostic message already issued if a problem
|
||||
// was encountered while looking for the overloaded operator->.
|
||||
if (!getLangOpts().CPlusPlus) {
|
||||
Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
|
||||
<< BaseType << int(IsArrow) << BaseExpr.get()->getSourceRange()
|
||||
<< FixItHint::CreateReplacement(OpLoc, ".");
|
||||
}
|
||||
IsArrow = false;
|
||||
} else if (BaseType->isFunctionType()) {
|
||||
goto fail;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// RUN: %clang_cc1 %s -verify -fsyntax-only
|
||||
// expected-no-diagnostics
|
||||
|
||||
struct simple { int i; };
|
||||
|
||||
|
@ -19,3 +18,7 @@ void g(void) {
|
|||
s->x = 1;
|
||||
s->z = 2;
|
||||
}
|
||||
|
||||
int PR17762(struct simple c) {
|
||||
return c->i; // expected-error {{member reference type 'struct simple' is not a pointer; maybe you meant to use '.'?}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue