title: CudaMemcpyToSymbol fails when called from constructor
body: <p>I could not find anything in the CUDA documentation to explain why cudaMemcpyToSymbol fails (with cudaErrorInvalidSymbol) in the following</p>
  
  <pre><code>__constant__ float dev[2];
  
  struct Struct
  {
      void construct()
      {
          float host[2] = {1, 2};
          cudaError_t error = cudaMemcpyToSymbol(dev, host, sizeof(host));
          printf(cudaGetErrorString(error));
      }
  };
  
  class Class
  {
  public:
      Class()
      {
          s.construct();
      }
  
  private:
      Struct s;
  };
  
  static Class instance;
  
  int main()
  {
  }
  </code></pre>
  
  <p>while it works when construct() is called from a method:</p>
  
  <pre><code>class Class
  {
  public:
      void foo()
      {
          s.construct();
      }
  
  private:
      Struct s;
  };
  
  static Class instance;
  
  int main()
  {
      instance.foo();
  }
  </code></pre>