When compiling CEGUI as C++11 using clang 3.5, I get a warning about returning a reference to a local temporary object:
I was a bit surprised so I made this stack overflow post: http://stackoverflow.com/questions/30518893/safe-to-return-const-to-object-passed-by-const
I thought that the code there was reasonably safe and the warning was safe to ignore, but the stack overflow folks seem to say that it's not a good way to do things.
The usage they are pointing out as problematic, where "def" is a constant string passed as an argument, seems to be how it's commonly used in cegui code.
I guess what I would suggest is
1) Change the function to return a String rather than const String &. I don't think this will make a performance difference, esp. in C++11 with move constructors.
2) Disable the warning, although it's usually a pretty good warning to have. You could put a #pragma gcc diagnostic ignored "-Wno-return-stack-address" in this file I guess. Most people disable warnings in libraries though so maybe there's no point to this.
It depends how worried you are that someone on your team will bind the results of this function to a local const String & some day I guess.