File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -368,15 +368,16 @@ kernel void foo() {
368368}
369369------------
370370
371- User defined constructors are not allowed to construct objects in `__constant`
372- address space. Such objects can be initialized using literals and
373- initialization lists if they do not require any user defined conversions.
371+ User defined constructors in `__constant` address space must be `constexpr`.
372+ Such objects can be initialized using literals and initialization lists if they
373+ do not require any user defined conversions.
374374
375375Objects in `__constant` address space can be initialized using:
376376
377377 * Literal expressions;
378378 * Uniform initialization syntax `{}`;
379379 * Using implicit constructors.
380+ * Using constexpr constructors.
380381
381382[source,cpp]
382383------------
@@ -386,14 +387,12 @@ struct C1 {
386387
387388struct C2 {
388389 int m;
389- C2(int init) __constant {};
390+ constexpr C2(int init) __constant : m(init) {};
390391};
391392
392- kernel void k() {
393- __constant C1 cobj1 = {1};
394- __constant C1 cobj2 = C1();
395- __constant C2 cobj3 = {1}; // error: user defined constructor can't be used
396- }
393+ __constant C1 cobj1 = {1};
394+ __constant C1 cobj2 = C1();
395+ __constant C2 cobj3(1);
397396------------
398397
399398==== Nested pointers
You can’t perform that action at this time.
0 commit comments