Error when copying vector bool to CUDA memory
<p>I encountered a compilation error where copying a bool vector to cuda memory will fail</p>

<pre><code>bool *gpu; 

cudaMalloc(reinterpret_cast&lt;void **&gt;(&amp;gpu), 100);

std::vector&lt;bool&gt; cpu(100);

for(int i=0;i&lt;100;i++){
  cpu[i]=true;
}

cudaMemcpy(gpu, cpu.data(), 100*sizeof(bool), cudaMemcpyHostToDevice);
</code></pre>

<p>It returns </p>

<pre><code>error: invalid use of void expression cudaMemcpyHostToDevice);
</code></pre>

<p>but the same code with a float vector will compile.</p>

<pre><code>float *gpu; 

cudaMalloc(reinterpret_cast&lt;void **&gt;(&amp;gpu), 100);

std::vector&lt;float&gt; cpu(100);

for(int i=0;i&lt;100;i++){
  cpu[i]=i;
}

cudaMemcpy(gpu, cpu.data(), 100*sizeof(float), cudaMemcpyHostToDevice);
</code></pre>

<p>Why is this happening?</p>