NVCC: ambiguous error message shift operator on float or double

Hi,

I used this quite complicated line of code to pack a short into a integer variable. Additionally I also did some calculation, but that is of no importance.

pix1 = pix1 & ((cost[(y+1)*pitch + (x+0)] & 0x000000ff + 0.5 * tex2D( tex, (y+1), (x+0))) << 24);

The problem is that the value is implicitly convertet to float because of “0.5 * tex2D …” and a shift operation does

not work on floats.

NVCC shows an error in this line of code and it has indeed an error, but the error message is not very specific and I had

to use MSVC2008 compiler to point out the error.

NVCC say simply: error: expression must have integral or enum type

MSVC2008 shows: error C2296: ‘<<’ : illegal, left operand has type ‘double’

Both error messages are correct, but msvc message is more specific.

Better error messages would improve the nvcc and save development time.