Apparently empty names are allowed here.

llvm-svn: 157117
This commit is contained in:
Benjamin Kramer 2012-05-19 16:34:46 +00:00
parent 1458c1c009
commit 365082dbfa
2 changed files with 6 additions and 4 deletions

View File

@ -1504,15 +1504,16 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
Decl *Member; Decl *Member;
if (isInstField) { if (isInstField) {
CXXScopeSpec &SS = D.getCXXScopeSpec(); CXXScopeSpec &SS = D.getCXXScopeSpec();
IdentifierInfo *II = Name.getAsIdentifierInfo();
// Data members must have identifiers for names. // Data members must have identifiers for names.
if (!II) { if (!Name.isIdentifier()) {
Diag(Loc, diag::err_bad_variable_name) Diag(Loc, diag::err_bad_variable_name)
<< Name; << Name;
return 0; return 0;
} }
IdentifierInfo *II = Name.getAsIdentifierInfo();
// Member field could not be with "template" keyword. // Member field could not be with "template" keyword.
// So TemplateParameterLists should be empty in this case. // So TemplateParameterLists should be empty in this case.
if (TemplateParameterLists.size()) { if (TemplateParameterLists.size()) {

View File

@ -1399,13 +1399,14 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
const ObjCInterfaceType *IFaceT = OPT->getInterfaceType(); const ObjCInterfaceType *IFaceT = OPT->getInterfaceType();
ObjCInterfaceDecl *IFace = IFaceT->getDecl(); ObjCInterfaceDecl *IFace = IFaceT->getDecl();
IdentifierInfo *Member = MemberName.getAsIdentifierInfo(); if (!MemberName.isIdentifier()) {
if (!Member) {
Diag(MemberLoc, diag::err_invalid_property_name) Diag(MemberLoc, diag::err_invalid_property_name)
<< MemberName << QualType(OPT, 0); << MemberName << QualType(OPT, 0);
return ExprError(); return ExprError();
} }
IdentifierInfo *Member = MemberName.getAsIdentifierInfo();
SourceRange BaseRange = Super? SourceRange(SuperLoc) SourceRange BaseRange = Super? SourceRange(SuperLoc)
: BaseExpr->getSourceRange(); : BaseExpr->getSourceRange();
if (RequireCompleteType(MemberLoc, OPT->getPointeeType(), if (RequireCompleteType(MemberLoc, OPT->getPointeeType(),