simple round trip locale test fails - visual studio .net 2013 locale libraries - dates - by Lewis Pringle

Status : 


Sign in
to vote
ID 808166 Comments
Status Active Workarounds
Type Bug Repros 0
Opened 11/9/2013 8:53:07 AM
Access Restriction Public


namespace {
    void	TestDateLocaleRoundTripsForDateWithThisLocaleLib_ (int tm_Year, int tm_Mon, int tm_mDay, const locale& l)
        tm origDateTM;
        memset (&origDateTM, 0, sizeof (origDateTM));
        origDateTM.tm_year = tm_Year;
        origDateTM.tm_mon = tm_Mon;
        origDateTM.tm_mday = tm_mDay;

        const wchar_t kPattern[] = L"%x";  // ... (%x is date representation, ...the specifiers marked with an asterisk (*) are locale-dependent)

        wstring tmpStringRep;
            const time_put<wchar_t>& tmput = use_facet <time_put<wchar_t>> (l);
            tm when = origDateTM;
            wostringstream oss;
            tmput.put (oss, oss, ' ', &when, begin (kPattern), begin (kPattern) + ::wcslen (kPattern));
            tmpStringRep = oss.str ();
        tm resultTM;
            memset (&resultTM, 0, sizeof (resultTM));
            const time_get<wchar_t>& tmget = use_facet <time_get<wchar_t>> (l);
            ios::iostate state = ios::goodbit;
            wistringstream iss (tmpStringRep);
            istreambuf_iterator<wchar_t> itbegin (iss);  // beginning of iss
            istreambuf_iterator<wchar_t> itend;          // end-of-stream
            tmget.get (itbegin, itend, iss, state, &resultTM, std::begin (kPattern), std::begin (kPattern) + ::wcslen (kPattern));
        Assert (origDateTM.tm_year == resultTM.tm_year);
        Assert (origDateTM.tm_mon == resultTM.tm_mon);
        Assert (origDateTM.tm_mday == resultTM.tm_mday);

    struct BuggyCasesTeReportToMSFT_ {
        BuggyCasesTeReportToMSFT_ ()
            TestDateLocaleRoundTripsForDateWithThisLocaleLib_ (105, 5, 1, locale::classic ());
    } _force_test_;

Sign in to post a comment.
Posted by Microsoft on 11/11/2013 at 1:51 AM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 11/9/2013 at 9:53 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(