mapnik/mapnik — Issue #1058: warning: "returning reference to local temporary object" in attribute.hpp
Author: springmeyer
Created: 2012-01-31 18:37:21+00:00
State: open

This appears to be a spurious compiler warning. But it happens in both clang++ trunk on osx and g++ on ubuntu: https://gist.github.com/1712083.

And ideally, even if the warning is spurious, it would be good to avoid it.

How about his? It goes away with clang++ with:

```diff
diff --git a/include/mapnik/parse_path.hpp b/include/mapnik/parse_path.hpp
index 250a175..fcbc6a0 100644
--- a/include/mapnik/parse_path.hpp
+++ b/include/mapnik/parse_path.hpp
@@ -64,7 +64,9 @@ struct path_processor
void operator() (attribute const& attr) const
{
// convert mapnik::value to std::string
- filename_ += attr.value(feature_).to_string();
+ mapnik::value const& val = feature_.get(attr.name());
+ filename_ += val.to_string();
+ //filename_ += attr.value(feature_).to_string();
}

std::string & filename_;
```