[llvm-bugs] [Bug 44177] New: Constexpr array not seen as constexpr
    via llvm-bugs 
    llvm-bugs at lists.llvm.org
       
    Thu Nov 28 22:40:15 PST 2019
    
    
  
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: unassignedclangbugs at nondot.org
          Reporter: drohr at jwdt.org
                CC: anastasia.stulova at arm.com, llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191129/dcf6e0d5/attachment.html>
    
    
More information about the llvm-bugs
mailing list