/// \brief The declaration that we found via name lookup, which might be
/// the same as \c ConversionFunction or it might be a using declaration
/// that refers to \c ConversionFunction.
- NamedDecl *FoundConversionFunction;
+ DeclAccessPair FoundConversionFunction;
void DebugPrint() const;
};
Found.getAccess() == AS_public)
return AR_accessible;
- const RecordType *RT = ObjectExpr->getType()->getAs<RecordType>();
- assert(RT && "found member operator but object expr not of record type");
+ const RecordType *RT = ObjectExpr->getType()->castAs<RecordType>();
CXXRecordDecl *NamingClass = cast<CXXRecordDecl>(RT->getDecl());
AccessTarget Entity(Context, AccessTarget::Member, NamingClass, Found,
QualType Ty,
CastKind Kind,
CXXMethodDecl *Method,
- NamedDecl *FoundDecl,
+ DeclAccessPair FoundDecl,
Expr *From) {
switch (Kind) {
default: assert(0 && "Unhandled cast kind!");
if (Result.isInvalid())
return ExprError();
+ S.CheckMemberOperatorAccess(CastLoc, From, /*arg*/ 0, FoundDecl);
+
return S.MaybeBindToTemporary(Result.get());
}
}
User.EllipsisConversion = false;
}
User.ConversionFunction = Constructor;
- User.FoundConversionFunction = Best->FoundDecl.getDecl();
+ User.FoundConversionFunction = Best->FoundDecl;
User.After.setAsIdentityConversion();
User.After.setFromType(ThisType->getAs<PointerType>()->getPointeeType());
User.After.setAllToTypes(ToType);
// implicit object parameter of the conversion function.
User.Before = Best->Conversions[0].Standard;
User.ConversionFunction = Conversion;
- User.FoundConversionFunction = Best->FoundDecl.getDecl();
+ User.FoundConversionFunction = Best->FoundDecl;
User.EllipsisConversion = false;
// C++ [over.ics.user]p2:
ICS.UserDefined.Before = Best->Conversions[0].Standard;
ICS.UserDefined.After = Best->FinalConversion;
ICS.UserDefined.ConversionFunction = Best->Function;
- ICS.UserDefined.FoundConversionFunction = Best->FoundDecl.getDecl();
+ ICS.UserDefined.FoundConversionFunction = Best->FoundDecl;
ICS.UserDefined.EllipsisConversion = false;
assert(ICS.UserDefined.After.ReferenceBinding &&
ICS.UserDefined.After.DirectBinding &&
Candidate.Conversions[0].UserDefined.Before = ObjectInit.Standard;
Candidate.Conversions[0].UserDefined.EllipsisConversion = false;
Candidate.Conversions[0].UserDefined.ConversionFunction = Conversion;
- Candidate.Conversions[0].UserDefined.FoundConversionFunction
- = FoundDecl.getDecl();
+ Candidate.Conversions[0].UserDefined.FoundConversionFunction = FoundDecl;
Candidate.Conversions[0].UserDefined.After
= Candidate.Conversions[0].UserDefined.Before;
Candidate.Conversions[0].UserDefined.After.setAsIdentityConversion();
void foo(int arg[__builtin_offsetof(B, ins)]);
}
}
+
+// rdar://problem/10155256
+namespace test8 {
+ class A {
+ typedef void* (A::*UnspecifiedBoolType)() const;
+ operator UnspecifiedBoolType() const; // expected-note {{implicitly declared private here}}
+ };
+
+ void test(A &a) {
+ if (a) return; // expected-error {{'operator void *(class test8::A::*)(void) const' is a private member of 'test8::A'}}
+ }
+}
+
+namespace test9 {
+ class A {
+ operator char*() const; // expected-note {{implicitly declared private here}}
+ };
+
+ void test(A &a) {
+ delete a; // expected-error {{'operator char *' is a private member of 'test9::A'}}
+ }
+}