CXXBasePaths::isAmbiguous(), rather than just asserting that we have a
canonical type. Fixes PR7176.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104374
91177308-0d34-0410-b5e6-
96231b3b80d8
/// \brief Determine whether the path from the most-derived type to the
/// given base type is ambiguous (i.e., it refers to multiple subobjects of
/// the same base type).
- bool isAmbiguous(QualType BaseType);
+ bool isAmbiguous(CanQualType BaseType);
/// \brief Whether we are finding multiple paths to detect ambiguities.
bool isFindingAmbiguities() const { return FindAmbiguities; }
/// ambiguous, i.e., there are two or more paths that refer to
/// different base class subobjects of the same type. BaseType must be
/// an unqualified, canonical class type.
-bool CXXBasePaths::isAmbiguous(QualType BaseType) {
- assert(BaseType.isCanonical() && "Base type must be the canonical type");
- assert(BaseType.hasQualifiers() == 0 && "Base type must be unqualified");
+bool CXXBasePaths::isAmbiguous(CanQualType BaseType) {
+ BaseType = BaseType.getUnqualifiedType();
std::pair<bool, unsigned>& Subobjects = ClassSubobjects[BaseType];
return Subobjects.second + (Subobjects.first? 1 : 0) > 1;
}
}
// B is a base of D. But is it an allowed base? If not, it's a hard error.
- if (Paths.isAmbiguous(DestClass)) {
+ if (Paths.isAmbiguous(Self.Context.getCanonicalType(DestClass))) {
Paths.clear();
Paths.setRecordingPaths(true);
bool StillOkay = Self.IsDerivedFrom(SrcClass, DestClass, Paths);
if (!IsDerivedFrom(CanonicalSubT, CanonicalSuperT, Paths))
continue;
- if (Paths.isAmbiguous(CanonicalSuperT))
+ if (Paths.isAmbiguous(Context.getCanonicalType(CanonicalSuperT)))
continue;
// Do this check from a context without privileges.
return object->*p2m; // expected-error {{left hand operand to ->*}}
}
}
+
+namespace PR7176 {
+ namespace base
+ {
+ struct Process
+ { };
+ struct Continuous : Process
+ {
+ bool cond();
+ };
+ }
+
+ typedef bool( base::Process::*Condition )();
+
+ void m()
+ { (void)(Condition) &base::Continuous::cond; }
+}