[llvm-bugs] [Bug 42566] New: Broken initialization of objects in __constant AS in C++ mode

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 10 09:33:05 PDT 2019


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: unassignedclangbugs at nondot.org
          Reporter: anastasia.stulova at arm.com
                CC: anastasia.stulova at arm.com, llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190710/e807173a/attachment.html>


More information about the llvm-bugs mailing list