Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-8748

Initializing unordered_map with an initializer_list fails with -o2 or higher

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-4329
    • Hide
      MSP430_18.1.0.LTS
      C2000_22.6.0.LTS
      MSP430_20.2.0.LTS
      MSP430_21.6.0.LTS
      C2000_21.6.0.LTS
      MSP430_18.12.0.LTS
      Show
      MSP430_18.1.0.LTS C2000_22.6.0.LTS MSP430_20.2.0.LTS MSP430_21.6.0.LTS C2000_21.6.0.LTS MSP430_18.12.0.LTS
    • Hide
      The following code prints out 'wg size 1', instead of 'wg size 3', which is the expected value:

      #include <unordered_map>
      #include <initializer_list>

      int main(void) {
      const std::pair<const long, wchar_t>
                  wp0(0, L'i'), wp1(1, L'm'), wp2(2, L'p');

              std::initializer_list<std::unordered_map<long, wchar_t>::value_type>
                  winit { wp0, wp1, wp2 };

      std::unordered_map<long, wchar_t> wg(winit);
              printf("wg size %zu\n", wg.size());
      }
      Show
      The following code prints out 'wg size 1', instead of 'wg size 3', which is the expected value: #include <unordered_map> #include <initializer_list> int main(void) { const std::pair<const long, wchar_t>             wp0(0, L'i'), wp1(1, L'm'), wp2(2, L'p');         std::initializer_list<std::unordered_map<long, wchar_t>::value_type>             winit { wp0, wp1, wp2 }; std::unordered_map<long, wchar_t> wg(winit);         printf("wg size %zu\n", wg.size()); }

      Initializing unordered_map with an initializer_list fails with -o2 or higher

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: