title: Bad Ptr when passing string reference as argument
body: <p>I've been trying to understand why the following code gives me a bad pointer on the string 'filename':</p>
  
  <pre><code>Mat imread(const string&amp; filename, int flags) { 
      // some code returning a Mat object 
  }
  
  int main() {
      string s = "test.jpg";
      imread(s, 0);
  }
  </code></pre>
  
  <p>I've debugged step-by-step and all I've got was that before entering <code>imread</code>, the string was fine (I was able to inspect each element of it), but afterwards it was impossible to do so, and the debugger accused a Bad Ptr. I'm not sure I understand why that happens.</p>
  
  <p>Just so you know, I'm using Visual Studio 2008 and OpenCV 2.2.</p>
  
  <p>EDIT: I have indeed forgotten to say one important thing, that was essential for me to solve this issue: I was writing this code on a .cu file, therefore being compiled by nvcc in a first instance.</p>