summaryrefslogtreecommitdiff
path: root/xsd/cxx/parser/element-validation-source.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xsd/cxx/parser/element-validation-source.cxx')
-rw-r--r--xsd/cxx/parser/element-validation-source.cxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/xsd/cxx/parser/element-validation-source.cxx b/xsd/cxx/parser/element-validation-source.cxx
index 3acba34..310ea27 100644
--- a/xsd/cxx/parser/element-validation-source.cxx
+++ b/xsd/cxx/parser/element-validation-source.cxx
@@ -308,9 +308,20 @@ namespace CXX
os << inst << "->" << post << " ();"
<< "this->" << name << " ();";
else
- os << arg_type (type) << " tmp (" << inst << "->" <<
- post << " ());"
- << "this->" << name << " (tmp);";
+ {
+ // Don't create an lvalue in C++11 (think std::unique_ptr).
+ // In C++98 we do it for compatibility with older/broken
+ // compilers (e.g., IBM xlC that needs an lvalue to pass
+ // std::auto_ptr).
+ //
+ if (options.std () == cxx_version::cxx98)
+ os << arg_type (type) << " tmp (" << inst << "->" <<
+ post << " ());"
+ << "this->" << name << " (tmp);";
+ else
+ os << "this->" << name << " (" << inst << "->" <<
+ post << " ());";
+ }
os << "}";
}