STL icon indicating copy to clipboard operation
STL copied to clipboard

<locale>: the enum value of std::money_base is not correct

Open MahmoudGSaleh opened this issue 5 years ago • 1 comments
trafficstars

Describe the bug money_base is defined as follows in C++ standard N3797:

class money_base {
public:
    enum part { none, space, symbol, sign, value };
    struct pattern { char field[4]; };
};

Command-line test case

1. >type repro.cpp
#include <locale>
#include <iostream>

int main()
{
    std::money_base mb;
    std::cout << mb.none << std::endl;
    std::cout << mb.space << std::endl;
    std::cout << mb.symbol<< std::endl;
    std::cout << mb.sign << std::endl;
    std::cout << mb.value << std::endl;
}

2. >cl /EHsc /W4 /WX .\repro.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29009.1 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

repro.cpp
Microsoft (R) Incremental Linker Version 14.27.29009.1
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:repro.exe
repro.obj

3. >.\repro.exe
120
32
36
43
118

Expected behavior

0
1
2
3
4

STL version

Microsoft Visual Studio Community 2019 Preview
Version 16.7.0 Preview 3.0

Additional context

  • Skipped libcxx test: https://github.com/microsoft/STL/blob/faccf0084ed9b8b58df103358174537233b178c7/tests/libcxx/expected_results.txt#L404-L405

  • Also tracked by Microsoft-internal AB#121977

MahmoudGSaleh avatar Jul 30 '20 03:07 MahmoudGSaleh

I believe that changing the values of these enumerators will break ABI; labeling as vNext.

StephanTLavavej avatar Jul 31 '20 01:07 StephanTLavavej