The address space for the Base class pointer when up-casting from Derived should be taken from the Derived class pointer.
Details
Diff Detail
Event Timeline
lib/Sema/SemaExpr.cpp | ||
---|---|---|
2670 | This path (when the object is a gl-value) also needs an address-space qualifier, so you should probably add it above and then just add a pointer in the pointer case. |
Moved adding address space to DestType earlier to cover pointer and non-pointer case.
lib/Sema/SemaExpr.cpp | ||
---|---|---|
2670 | I updated this but I haven't really found any test case that would fail. I guess because casting non-pointer types in different address spaces works fine... For example the IR is generated correctly with or without the fix. 1 struct S { 2 volatile int a; 3 }; 4 5 __global S g; 6 7 void foo(){ 8 g.a; 9 } However, I still think it's indeed good to add the address space in both cases for consistency. |
lib/Sema/SemaExpr.cpp | ||
---|---|---|
2666 | Please do a getAs<PointerType>() into a local and then use that here and below. |
lib/Sema/SemaExpr.cpp | ||
---|---|---|
2667 | And here. |
lib/Sema/SemaExpr.cpp | ||
---|---|---|
2667 | Oh, yes... thanks! |
Please do a getAs<PointerType>() into a local and then use that here and below.