[llvm-bugs] [Bug 32662] New: Address space 8388355 should not be generic in C++
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Apr 14 03:32:55 PDT 2017
http://bugs.llvm.org/show_bug.cgi?id=32662
Bug ID: 32662
Summary: Address space 8388355 should not be generic in C++
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: pkeir at outlook.com
CC: llvm-bugs at lists.llvm.org
Created attachment 18286
--> http://bugs.llvm.org/attachment.cgi?id=18286&action=edit
A MWE similar to the example described
LLVM supports address space annotation such as:
__attribute__((address_space(42))) int *p;
A most useful aspect of their functionality is knowing that such pointers
cannot be converted to one another. For example, this static assert passes:
using pt1 = __attribute__((address_space(1))) int *;
using pt2 = __attribute__((address_space(2))) int *;
static_assert(!std::is_convertible<pt0,pt1>::value,"");
Though this functionality has many uses within standard C++, LLVM's OpenCL
implementation also uses this feature. Since around Clang 3.9, however, an
aspect particular to OpenCL appears when compiling C++. This aspect should
rather rely on the user specifying explicitly that OpenCL is to be compiled;
perhaps via "-x cl -cl-std=CL2.0".
Address space 8388355 is used by Clang to implement the generic address space
added in OpenCL 2.0. In C++, converting a pointer targeting address space
8388355 should behave the same as pointers targeting other address spaces: it
should not be convertible.
As a concrete example, the following should not produce an error, but as of
Clang 3.9 it does:
using pt1 = __attribute__((address_space(1))) int *;
using pt2 = __attribute__((address_space(2))) int *;
using pt8388355 = __attribute__((address_space(8388355))) int *;
static_assert(!std::is_convertible<pt0,pt8388355>::value,"");
static_assert(!std::is_convertible<pt1,pt8388355>::value,"");
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170414/0c21f10d/attachment.html>
More information about the llvm-bugs
mailing list