https://bugs.llvm.org/show_bug.cgi?id=42566

            Bug ID: 42566
           Summary: Broken initialization of objects in __constant AS in
                    C++ mode
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: OpenCL
          Assignee: unassignedclangb...@nondot.org
          Reporter: anastasia.stul...@arm.com
                CC: anastasia.stul...@arm.com, llvm-bugs@lists.llvm.org

When compiling with -cl-std=++ the following test case a number of errors seem
to be produced incorrectly:

struct X {
 int x;
 X(int x) __constant : x(x) {}
};

kernel void barX() {
 __constant X x(0); // error: initializer element is not a compile-time
constant
}

struct Y {
 int y;
};

kernel void barY() {
 __constant Y y = { 0 }; // Okay
}

struct Z {
 Z() __constant = default;
};

kernel void barZ() {
 __constant Z z1; // error: variable in constant address space must be
initialized
 __constant Z z2 = Z(); // error: no matching constructor for initialization of
'Z'
                        // note: candidate constructor ignored: cannot be used
to construct an object in address space unqualified
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to