title: Trying to assign an extern __shared__ memory pointer leads to "expression must be a modifiable lvalue" error
body: <p>I have something like the code below:</p>
  
  <pre><code>__device__ unsigned char* device_func(unsigned char* var_sh, unsigned char param){
      if (var_sh[0] == param)
          return var_sh + param;
      else return 0;
  }
  
  __global__ void global_func(uchar parameters){
      extern __shared__ unsigned char var_sh[];
      //just copying things from global to shared memory:
      for(int i = blockIndex; i &lt; size; i += blockDim.x * gridDim.x){
          var_sh[i] = rla-&gt;initial[i]; 
      }
      var_sh = device_func(var_sh, parameters);
  }
  </code></pre>
  
  <p>This global function is called in this way:</p>
  
  <pre><code>global_func&lt;&lt;&lt; blocks,threads,shared_size &gt;&gt;&gt;(parameters);
  </code></pre>
  
  <p>But when I try to compile, the compiler returns the following error on the line "var_sh = device_func(var_sh, parameters);":</p>
  
  <p>"error: expression must be a modifiable lvalue"</p>
  
  <p>I don't know why, can someone explain?</p>