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

            Bug ID: 44177
           Summary: Constexpr array not seen as constexpr
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: OpenCL
          Assignee: unassignedclangb...@nondot.org
          Reporter: dr...@jwdt.org
                CC: anastasia.stul...@arm.com, llvm-bugs@lists.llvm.org

Created attachment 22880
  --> https://bugs.llvm.org/attachment.cgi?id=22880&action=edit
Testcase

The attached code (which works correctly with standard C++, and also with CUDA)
fails in OpenCL because the constexpr array zSize is not interpreted as
constexpr.

Command to reproduce:
clang++ -cl-std=clc++ -Xclang -finclude-default-header -o test test2.cl

Error message:
test2.cl:54:57: error: constexpr function never produces a constant expression
[-Winvalid-constexpr]
GPU_HOST_DEVICE constexpr GPUArray<float, LayersNumber> InverseZBinSize()
                                                        ^
test2.cl:57:57: note: subexpression not valid in a constant expression
  return GPUArray<float, LayersNumber>{{0.5f * ZBins / (zSize[0]), 0.5f * ZBins
/ (zSize[1]), 0.5f * ZBins / (zSize[2]),

-- 
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