This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/50117] [C++0x] Segmentation fault when using std::make_pair with std::ofstream
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 18 Aug 2011 13:10:55 +0000
- Subject: [Bug c++/50117] [C++0x] Segmentation fault when using std::make_pair with std::ofstream
- Auto-submitted: auto-generated
- References: <bug-50117-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50117
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-08-18 13:10:55 UTC ---
(Obviously it shouldn't crash the compiler, but ...)
you probably don't want to use std::make_pair<X, Y> in C++0x, i.e. with an
explicit template argument list. The definition of make_pair has changed, and
it doesn't do what you might think it does.
The sole purpose of make_pair is to deduce its argument types. If you want to
defeat type deduction by specifying the types, just say:
std::pair<int, std::ofstream> p(int(), std::ofstream());