summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Parse/ParseExpr.cpp11
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp6
2 files changed, 6 insertions, 11 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index 95a0e989471..d2b3b84eb7f 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -341,17 +341,6 @@ Parser::ParseRHSOfBinaryExpression(OwningExprResult LHS, unsigned MinPrec) {
ColonLoc = ConsumeToken();
}
- if ((OpToken.is(tok::periodstar) || OpToken.is(tok::arrowstar))
- && Tok.is(tok::identifier)) {
- CXXScopeSpec SS;
- if (Actions.getTypeName(*Tok.getIdentifierInfo(),
- Tok.getLocation(), CurScope, &SS)) {
- const char *Opc = OpToken.is(tok::periodstar) ? "'.*'" : "'->*'";
- Diag(OpToken, diag::err_pointer_to_member_type) << Opc;
- return ExprError();
- }
-
- }
// Parse another leaf here for the RHS of the operator.
// ParseCastExpression works here because all RHS expressions in C have it
// as a prefix, at least. However, in C++, an assignment-expression could
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 0eea169b072..cf2c696c2b9 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -1445,6 +1445,12 @@ QualType Sema::CheckPointerToMemberOperands(
}
}
+ if (isa<CXXZeroInitValueExpr>(rex)) {
+ // Diagnose use of pointer-to-member type which when used as
+ // the functional cast in a pointer-to-member expression.
+ Diag(Loc, diag::err_pointer_to_member_type) << isIndirect;
+ return QualType();
+ }
// C++ 5.5p2
// The result is an object or a function of the type specified by the
// second operand.
OpenPOWER on IntegriCloud