Skip to content

Commit 86afed1

Browse files
[C++ for OpenCL] Improve description of restricted C++ features. (#582)
Added the following restrictions that were omitted: - references to functions; - pointers to member functions; Added clarification for: - thread-safety of static locals initialization. Added references to C++ spec sections where applicable.
1 parent 6774952 commit 86afed1

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

cxx4opencl/diff2cxx.txt

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,26 @@ however, there are some differences that are documented in this section.
1212

1313
The following {cpp} language features are not supported:
1414

15-
* Virtual functions
16-
* Exceptions
17-
* `dynamic_cast` operator
18-
* Non-placement `new`/`delete` operators
19-
* Standard C++ libraries
15+
* Virtual functions ({cpp}17 `[class.virtual]`);
16+
* References to functions including member functions ({cpp}17 `[class.mfct]`);
17+
* Pointers to class member functions (in addition to the regular non-member
18+
functions that are already restricted in OpenCL C);
19+
* Exceptions ({cpp}17 `[except]`);
20+
* `dynamic_cast` operator ({cpp}17 `[expr.dynamic.cast]`);
21+
* Non-placement `new`/`delete` operators ({cpp}17
22+
`[expr.new]`/`[expr.delete]`);
23+
* Standard C++ libraries ({cpp}17 `[library]`).
24+
25+
:fn-feature-macro: footnote:[The macro belongs to the list of {cpp}20's \
26+
feature test macros.]
27+
28+
Simultaneous initialization of static local objects performed by
29+
different work-items is not guaranteed to be free from race-conditions.
30+
Whether an implementation provides such a guarantee is indicated by the
31+
presence of the `__cpp_threadsafe_static_init` feature test
32+
macro{fn-feature-macro}.
33+
34+
The list above only contains extra restrictions that are not detailed in OpenCL
35+
C. As OpenCL restricts a number of C features, the same restrictions are
36+
inherited by C++ for OpenCL. The detailed list of C feature restrictions
37+
is provided in `OpenCL C v2.0 section 6.9`.

0 commit comments

Comments
 (0)