type ignoring cv-qualifiers). These are qualification
conversions. Fixes PR7934.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111428
91177308-0d34-0410-b5e6-
96231b3b80d8
QualType FromPointeeType = FromTypePtr->getPointeeType();
+ // If the unqualified pointee types are the same, this can't be a
+ // pointer conversion, so don't do all of the work below.
+ if (Context.hasSameUnqualifiedType(FromPointeeType, ToPointeeType))
+ return false;
+
// An rvalue of type "pointer to cv T," where T is an object type,
// can be converted to an rvalue of type "pointer to cv void" (C++
// 4.10p2).
Y f2(foo());
}
+
+namespace PR7934 {
+ typedef unsigned char uint8;
+
+ struct MutablePtr {
+ MutablePtr() : ptr(0) {}
+ void *ptr;
+
+ operator void*() { return ptr; }
+
+ private:
+ operator uint8*() { return reinterpret_cast<uint8*>(ptr); }
+ operator const char*() const { return reinterpret_cast<const char*>(ptr); }
+ };
+
+ void fake_memcpy(const void *);
+
+ void use() {
+ MutablePtr ptr;
+ fake_memcpy(ptr);
+ }
+}