Various pieces of code, like base initialization in Sema and RTTI IRGen,
don't properly ignore qualifiers on base classes. Instead of auditing the
whole codebase, just strip them off in the getter. (The type as written is
still available in the TypeSourceInfo for code that cares.)
Fixes PR16596.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186125
91177308-0d34-0410-b5e6-
96231b3b80d8
/// \brief Retrieves the type of the base class.
///
/// This type will always be an unqualified class type.
- QualType getType() const { return BaseTypeInfo->getType(); }
+ QualType getType() const {
+ return BaseTypeInfo->getType().getUnqualifiedType();
+ }
/// \brief Retrieves the type and source location of the base class.
TypeSourceInfo *getTypeSourceInfo() const { return BaseTypeInfo; }
union { void *a; };
};
}
+
+namespace PR16596 {
+ class A { public: virtual ~A(); };
+ typedef const A Foo;
+ void Apply(Foo processor);
+ struct Bar : public Foo {};
+ void Fetch() {
+ Apply(Bar());
+ }
+}