ios: Don't return & for fpos - and + operators
diff mbox series

Message ID 20191010040600.364-1-rosenp@gmail.com
State New
Headers show
Series
  • ios: Don't return & for fpos - and + operators
Related show

Commit Message

Rosen Penev Oct. 10, 2019, 4:06 a.m. UTC
Throws a Weffc++ warning:

warning: ‘std::fpos<state>& std::fpos<state>::operator+(const streamoff&)’
should return by value [-Weffc++]

A similar change was made to gcc's libstdcpp back in 2001.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 include/ios | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/include/ios b/include/ios
index ac6566a..87d6c3a 100644
--- a/include/ios
+++ b/include/ios
@@ -478,11 +478,11 @@  namespace std{
 		_UCXXEXPORT bool operator!=(const fpos &rhs){
 			return st != rhs.st;
 		}
-		_UCXXEXPORT fpos & operator+(const streamoff & o){
+		_UCXXEXPORT fpos operator+(const streamoff & o){
 			st += o;
 			return *this;
 		}
-		_UCXXEXPORT fpos & operator-(const streamoff & o){
+		_UCXXEXPORT fpos operator-(const streamoff & o){
 			st -= o;
 			return *this;
 		}