Author: efriedma
Date: Thu Jul 11 17:22:22 2013
New Revision: 186125

URL: http://llvm.org/viewvc/llvm-project?rev=186125&view=rev
Log:
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.

Modified:
    cfe/trunk/include/clang/AST/DeclCXX.h
    cfe/trunk/test/SemaCXX/class-base-member-init.cpp

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=186125&r1=186124&r2=186125&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Thu Jul 11 17:22:22 2013
@@ -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; }

Modified: cfe/trunk/test/SemaCXX/class-base-member-init.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/class-base-member-init.cpp?rev=186125&r1=186124&r2=186125&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/class-base-member-init.cpp (original)
+++ cfe/trunk/test/SemaCXX/class-base-member-init.cpp Thu Jul 11 17:22:22 2013
@@ -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());
+  }
+}


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to