If we construct an object in some arbitrary non-default addr space it should fail unless either:
- There is an implicit conversion from the address space to default/generic address space.
- There is a matching ctor qualified with an address space that is either exactly matching or convertible to the address space of an object.
Example - case 1:
struct MyType {
MyType(int i) : i(i) {}
int i;
};
__constant MyType m(1); // error: can't convert from __constant to __genericExample - case 2:
struct MyType {
MyType(int i) __constant : i(i) {}
MyType(int i) : i(i) {}
int i;
};
__constant MyType c(1); // there is __constant qualified ctor
__global MyType g(1); // there is a valid conversion between __global and __generic