Maybe I am missing something obvious. Here is a short example:

#include <iostream>
#include <string>

using namespace std;

class sample {
  sample(const string& val) : m_val(val) { };
  string val() { return m_val; };
  string m_val;

int main(int argc, char** argv)
  string val("foo");
  sample* s = new sample(val);
  /* set breakpoint here */
  cout << s->val() << endl;
  return 0;
If I set a break point where I have indicated above and
then use the evaluate panel to try to evaluate:


I get the error:

calling functions which return an aggregate by value is not supported
If I have a function that returns an STL string, how can
I call it? Note: this example is purposefully simple. In the
real app, the string is computed (not stored).