Make CXXBaseSpecifier::getType return unqual type.
authorEli Friedman <eli.friedman@gmail.com>
Thu, 11 Jul 2013 22:22:22 +0000 (22:22 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Thu, 11 Jul 2013 22:22:22 +0000 (22:22 +0000)
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

clang/include/clang/AST/DeclCXX.h
clang/test/SemaCXX/class-base-member-init.cpp

index 155cbe5..52909fb 100644 (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; }
index 2cdca82..8344e6f 100644 (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());
+  }
+}