[PATCH] PR libstdc++/82917 add missing returns in <fstream>

Jonathan Wakely jwakely@redhat.com
Fri Nov 10 21:44:00 GMT 2017


Thanks to the front-end now checking my dumb mistakes, these functions
no longer compiled - yay for G++ improvements!

	PR libstdc++/82917
	* include/std/fstream (basic_ifstream::open, basic_ofstream::open)
	(basic_fstream::open): Fix missing return.

Tested powerpc64le-linux, committed to trunk.

-------------- next part --------------
commit a15c3d1af29deb46eae9bfe3da4bf6b44de5020e
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Nov 10 20:59:47 2017 +0000

    PR libstdc++/82917 add missing returns in <fstream>
    
            PR libstdc++/82917
            * include/std/fstream (basic_ifstream::open, basic_ofstream::open)
            (basic_fstream::open): Fix missing return.

diff --git a/libstdc++-v3/include/std/fstream b/libstdc++-v3/include/std/fstream
index a3324c004d7..26176afccd0 100644
--- a/libstdc++-v3/include/std/fstream
+++ b/libstdc++-v3/include/std/fstream
@@ -663,7 +663,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       template<typename _Path>
 	auto
 	open(const _Path& __s, ios_base::openmode __mode = ios_base::in)
-	-> decltype(_M_filebuf.open(__s, __mode))
+	-> decltype((void)_M_filebuf.open(__s, __mode))
 	{ open(__s.c_str(), __mode); }
 #endif // C++17
 #endif // C++11
@@ -891,7 +891,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       template<typename _Path>
 	auto
 	open(const _Path& __s, ios_base::openmode __mode = ios_base::out)
-	-> decltype(_M_filebuf.open(__s, __mode))
+	-> decltype((void)_M_filebuf.open(__s, __mode))
 	{ open(__s.c_str(), __mode); }
 #endif // C++17
 #endif // C++11
@@ -1118,7 +1118,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	auto
 	open(const _Path& __s,
 	     ios_base::openmode __mode = ios_base::in | ios_base::out)
-	-> decltype(_M_filebuf.open(__s, __mode))
+	-> decltype((void)_M_filebuf.open(__s, __mode))
 	{ open(__s.c_str(), __mode); }
 #endif // C++17
 #endif // C++11


More information about the Libstdc++ mailing list