[PATCH] D102689: [C++4OpenCL] Allow address space conversion in reinterpret_cast

2021-06-01 Thread Ole Strohm via Phabricator via cfe-commits
olestrohm added inline comments. Comment at: clang/lib/Sema/SemaCast.cpp:2359 - if (SrcType == DestType) { + if (SrcType == Self.Context.removeAddrSpaceQualType(DestType)) { // C++ 5.2.10p2 has a note that mentions that, subject to all other rjmccall wro

[PATCH] D102689: [C++4OpenCL] Allow address space conversion in reinterpret_cast

2021-05-28 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: clang/lib/Sema/SemaCast.cpp:2359 - if (SrcType == DestType) { + if (SrcType == Self.Context.removeAddrSpaceQualType(DestType)) { // C++ 5.2.10p2 has a note that mentions that, subject to all other I think the u

[PATCH] D102689: [C++4OpenCL] Allow address space conversion in reinterpret_cast

2021-05-26 Thread Ole Strohm via Phabricator via cfe-commits
olestrohm updated this revision to Diff 347922. olestrohm added a comment. I've cleaned up the check. The qualifiers of SrcType are removed prior to this function, so only DestType needs to have the address space removed. reinterpret_cast only allows integral types, so structs are not an issue h

[PATCH] D102689: [C++4OpenCL] Allow address space conversion in reinterpret_cast

2021-05-24 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. In D102689#2778072 , @rsmith wrote: > In D102689#2778011 , @rjmccall > wrote: > >> The C++ standard does not appear to have similar wording. On the other >> hand, the C++ standard says

[PATCH] D102689: [C++4OpenCL] Allow address space conversion in reinterpret_cast

2021-05-24 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. In D102689#2778011 , @rjmccall wrote: > The C++ standard does not appear to have similar wording. On the other hand, > the C++ standard says that e.g. "The result of the expression `(T) > cast-expression` is of type `T`", and si

[PATCH] D102689: [C++4OpenCL] Allow address space conversion in reinterpret_cast

2021-05-24 Thread John McCall via Phabricator via cfe-commits
rjmccall added a reviewer: rsmith. rjmccall added a comment. Top-level qualifiers aren't normally meaningful on pr-values. The C standard says that casts are to the unqualified type: N2454 6.5.4p5: Preceding an expression by a parenthesized type name converts the value of the expression to th

[PATCH] D102689: [C++4OpenCL] Allow address space conversion in reinterpret_cast

2021-05-20 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment. Just to move the discussion from https://reviews.llvm.org/D101519 here. First of all I think this change should not be OpenCL specific i.e. there is not reason to do something different from C++ in general. Embedded C doesn't regulate the conversions between non-poin

[PATCH] D102689: [C++4OpenCL] Allow address space conversion in reinterpret_cast

2021-05-18 Thread Ole Strohm via Phabricator via cfe-commits
olestrohm created this revision. olestrohm added reviewers: Anastasia, rjmccall. olestrohm added a project: clang. Herald added subscribers: ldrumm, yaxunl. olestrohm requested review of this revision. Herald added a subscriber: cfe-commits. Allow converting between types with different address sp