Opened 4 years ago

Last modified 4 years ago

#10448 new Support Requests

MSVC bug with default argument passing - a workaround is required

Reported by: merkin@… Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.56.0 Severity: Problem
Keywords: Cc:

Description

MSVC 2010-2013 for x64 may pass default values incorrectly.

I met this bug with such innocent code:

std::wcout << boost::filesystem::path(L"ABC");

and got hieroglyphs around ABC instead of quotation marks.

To workaround the bug: just add (Char) prior to default values in the declaration of boost::io::detail::quote (boost/io/detail/quoted_manip.hpp)

    //  manipulator for const std::basic_string&
    template <class Char, class Traits, class Alloc>
      detail::quoted_proxy<std::basic_string<Char, Traits, Alloc> const &, Char>
        quoted(const std::basic_string<Char, Traits, Alloc>& s,
               Char escape=(Char)'\\', Char delim=(Char)'\"');

    //  manipulator for non-const std::basic_string&
    template <class Char, class Traits, class Alloc>
      detail::quoted_proxy<std::basic_string<Char, Traits, Alloc> &, Char>
        quoted(std::basic_string<Char, Traits, Alloc>& s,
               Char escape=(Char)'\\', Char delim=(Char)'\"');

    //  manipulator for const C-string*
    template <class Char>
      detail::quoted_proxy<const Char*, Char>
        quoted(const Char* s, Char escape=(Char)'\\', Char delim=(Char)'\"');

I did not scan other sources with similar problem; could you please check them yourselves?

P.S. GODDAMN! Your tracker disallows me to tell you the detailed description of the MSVC bug on its tracker. It treats the URL as spam. Please combine the URL from these pieces:

connect.microsoft.com /VisualStudio /feedbackdetail /view / 962812

Attachments (1)

quoted_manip.hpp (6.5 KB) - added by merkin@… 4 years ago.
the patched version of the boost/io/detail/quoted_manip.hpp

Download all attachments as: .zip

Change History (2)

Changed 4 years ago by merkin@…

Attachment: quoted_manip.hpp added

the patched version of the boost/io/detail/quoted_manip.hpp

comment:1 Changed 4 years ago by viboes

Component: Nonefilesystem
Owner: set to Beman Dawes
Note: See TracTickets for help on using tickets.