initializer element IS a compile-time constant

initializer element IS a compile-time constant

Why does one line fail while the other succeeds.

#pragma OPENCL EXTENSION cl_khr_fp64 : enableconstant unsigned const precision = 3;
constant unsigned const preciselyu = 1 << precision;
constant double const preciselyd = (double)(preciselyu);
constant double const ipreciselyd = 1.0 / preciselyd; // FAILS "error: initializer element is not a compile-time constant"
constant double const ipreciselyd = 1.0 / (double)(preciselyu); // WORKS

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Best Reply

Hi

Thanks for reporting this issue. We identified the root cause of this topic.

It will be fixed in future versions.
Thanks, Shiri

Leave a Comment

Please sign in to add a comment. Not a member? Join today