Opened 15 years ago
Closed 13 years ago
#1389 closed Bugs (wontfix)
filesystem::ostream << boost::format generates operator ambigious error (in MSVC++)
Reported by: | Owned by: | Beman Dawes | |
---|---|---|---|
Milestone: | To Be Determined | Component: | filesystem |
Version: | Boost 1.34.1 | Severity: | Problem |
Keywords: | Cc: |
Description
The following code
#include <boost/format.hpp> #include <boost/filesystem/fstream.hpp> void foo () { using namespace boost::filesystem; ofstream file ( "foo.txt" ); file << boost::format("hello"); }
generates the following compilation error with MSVC++ 7.1:
d:\foo.cpp(8) : error C2593: 'operator <<' is ambiguous
d:\Programs\boost\boost_1_34_0\boost\filesystem\path.hpp(617): could be 'std::basic_ostream<_Elem,_Traits> &boost::filesystem::operator <<>(std::basic_ostream<_Elem,_Traits> &,const Path &)' with [
_Elem=char, _Traits=std::char_traits, Ch=char, Path=boost::basic_format
] d:\Programs\boost\boost_1_34_0\boost\format\free_funcs.hpp(33): or 'std::basic_ostream<_Elem,_Traits> &boost::operator <<,std::allocator<_Ty>>(std::basic_ostream<_Elem,_Traits> &,const boost::basic_format &)' [found using argument-dependent lookup] with [
_Elem=char, _Traits=std::char_traits, _Ty=char, Ch=char
] while trying to match the argument list '(boost::filesystem::ofstream, boost::basic_format)' with [
Ch=char
]
Compiled with options [ /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Gm /RTC1 /MLd /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c /ZI /TP /EHa ]
The problem will be resolved by Filesystem V3.
Unless there are reports that this is causing serious inconvenience, this isn't going to get fixed for Filesystem v2.
Thanks for your patience,
--Beman