File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -354,6 +354,20 @@ is required for classes with data members that are references because their valu
354354can not be overwritten trivially. Destructors of local address space objects
355355are not invoked automatically. They can be called manually.
356356
357+ [source,cpp]
358+ ------------
359+ class C {
360+ int m;
361+ };
362+
363+ kernel void foo() {
364+ __local C locobj{}; // error: local address space objects can't be initialized
365+ __local C locobj; // uninitialised object
366+ locobj = {}; // calling copy assignment operator is allowed
367+ locobj.~C(); // local address space object destructors are not invoked automatically.
368+ }
369+ ------------
370+
357371User defined constructors are not allowed to construct objects in `__constant`
358372address space. Such objects can be initialized using literals and
359373initialization lists if they do not require any user defined conversions.
@@ -364,6 +378,24 @@ Objects in `__constant` address space can be initialized using:
364378 * Uniform initialization syntax `{}`;
365379 * Using implicit constructors.
366380
381+ [source,cpp]
382+ ------------
383+ struct C1 {
384+ int m;
385+ };
386+
387+ struct C2 {
388+ int m;
389+ C2(int init) __constant {};
390+ };
391+
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+ }
397+ ------------
398+
367399==== Nested pointers
368400
369401{cpp} for OpenCL does not allow implicit address space conversions in nested
You can’t perform that action at this time.
0 commit comments