@@ -675,16 +675,6 @@ static bool LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R,
675
675
CXXScopeSpec &SS, bool HasTemplateArgs,
676
676
SourceLocation TemplateKWLoc,
677
677
TypoExpr *&TE) {
678
- #if 0
679
- DeclContext *DC = SemaRef.computeDeclContext(RTy);
680
- // If the object expression is dependent and isn't the current instantiation,
681
- // lookup will not find anything and we must defer until instantiation.
682
- if (!DC) {
683
- R.setNotFoundInCurrentInstantiation();
684
- return false;
685
- }
686
- #endif
687
-
688
678
// FIXME: Should this use Name.isDependentName()?
689
679
if (DeclarationName Name = R.getLookupName ();
690
680
Name.getNameKind () == DeclarationName::CXXConversionFunctionName &&
@@ -712,49 +702,18 @@ static bool LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R,
712
702
MOUS,
713
703
TemplateKWLoc);
714
704
}
715
- #if 1
716
- SemaRef.LookupParsedName (R, /* S=*/ nullptr , &SS, ObjectType);
717
- #else
718
- if (SS.isSet()) {
719
- // If the member name was a qualified-id, look into the
720
- // nested-name-specifier.
721
- DC = SemaRef.computeDeclContext(SS, false);
722
- // We tried to look into a dependent context that is not the current
723
- // instantiation. Defer lookup until instantiation.
724
- if (!DC) {
725
- R.setNotFoundInCurrentInstantiation();
726
- return false;
727
- }
728
-
729
- if (SemaRef.RequireCompleteDeclContext(SS, DC)) {
730
- SemaRef.Diag(SS.getRange().getEnd(), diag::err_typecheck_incomplete_tag)
731
- << SS.getRange() << DC;
732
- return true;
733
- }
734
-
735
- assert(DC && "Cannot handle non-computable dependent contexts in lookup");
736
-
737
- if (!isa<TypeDecl>(DC)) {
738
- SemaRef.Diag(R.getNameLoc(), diag::err_qualified_member_nonclass)
739
- << DC << SS.getRange();
740
- return true;
741
- }
742
- }
743
705
744
- // The record definition is complete, now look up the member.
745
- SemaRef.LookupQualifiedName(R, DC, SS);
746
- #endif
706
+ SemaRef.LookupParsedName (R, /* S=*/ nullptr , &SS, ObjectType);
747
707
748
708
if (!R.empty () || R.wasNotFoundInCurrentInstantiation ())
749
709
return false ;
750
710
751
711
DeclarationName Typo = R.getLookupName ();
752
712
SourceLocation TypoLoc = R.getNameLoc ();
753
- # if 1
713
+ // Recompute the lookup context.
754
714
DeclContext *DC = SS.isSet ()
755
715
? SemaRef.computeDeclContext (SS)
756
716
: SemaRef.computeDeclContext (RTy);
757
- #endif
758
717
759
718
struct QueryState {
760
719
Sema &SemaRef;
@@ -1016,7 +975,11 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
1016
975
ActOnMemberAccessExtraArgs *ExtraArgs) {
1017
976
assert (!SS.isInvalid () && " nested-name-specifier cannot be invalid" );
1018
977
if (R.wasNotFoundInCurrentInstantiation () ||
978
+ #if 0
1019
979
(SS.isValid() && !computeDeclContext(SS, false))) {
980
+ #else
981
+ false ) {
982
+ #endif
1020
983
return ActOnDependentMemberExpr (BaseExpr, BaseExprType, IsArrow, OpLoc, SS,
1021
984
TemplateKWLoc, FirstQualifierInScope,
1022
985
R.getLookupNameInfo (), TemplateArgs);
@@ -1060,8 +1023,6 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
1060
1023
// Rederive where we looked up.
1061
1024
DeclContext *DC = (SS.isSet () ? computeDeclContext (SS, false )
1062
1025
: computeDeclContext (BaseType));
1063
- // : BaseType->getAsRecordDecl());
1064
-
1065
1026
if (ExtraArgs) {
1066
1027
ExprResult RetryExpr;
1067
1028
if (!IsArrow && BaseExpr && !BaseExpr->isTypeDependent ()) {
@@ -1087,7 +1048,7 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
1087
1048
}
1088
1049
}
1089
1050
1090
- if (SS.isInvalid () || (SS. isNotEmpty () && !DC) ) {
1051
+ if (SS.isNotEmpty () && !DC) {
1091
1052
Diag (R.getNameLoc (), diag::err_undeclared_use)
1092
1053
<< MemberName << SS.getRange ();
1093
1054
} else if (DC) {
@@ -1100,16 +1061,6 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
1100
1061
<< MemberName << BaseExprType
1101
1062
<< (BaseExpr ? BaseExpr->getSourceRange () : SourceRange ());
1102
1063
}
1103
-
1104
- if (DC) {
1105
- } else {
1106
- #if 0
1107
- // FIXME: Is this needed?
1108
- Diag(R.getNameLoc(), diag::err_no_member)
1109
- << MemberName << BaseExprType
1110
- << (BaseExpr ? BaseExpr->getSourceRange() : SourceRange());
1111
- #endif
1112
- }
1113
1064
return ExprError ();
1114
1065
}
1115
1066
0 commit comments