Make CXXBaseSpecifier::getType return unqual type.

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.

llvm-svn: 186125
This commit is contained in:
Eli Friedman 2013-07-11 22:22:22 +00:00
parent 7df860a629
commit a0e6a7fcd8
2 changed files with 13 additions and 1 deletions

View File

@ -250,7 +250,9 @@ public:
/// \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; }

View File

@ -98,3 +98,13 @@ namespace rdar13185264 {
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());
}
}