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

Compiler incorrectly rejects constexpr for array where length is not specified

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-7681
    • Hide
      C7000_1.4.0.LTS
      C6000_8.3.0
      MSP430_20.2.0.LTS
      ARM_18.12.0.LTS
      MSP430_18.12.0.LTS
      ARM_20.2.0.LTS
      Show
      C7000_1.4.0.LTS C6000_8.3.0 MSP430_20.2.0.LTS ARM_18.12.0.LTS MSP430_18.12.0.LTS ARM_20.2.0.LTS
    • Hide
      C7000_1.4.1.LTS*
      MSP430_18.12.7.LTS*
      ARM_18.12.7.LTS*
      C6000_8.3.8*
      ARM_20.2.3.LTS*
      MSP430_20.2.3.LTS*
      Show
      C7000_1.4.1.LTS* MSP430_18.12.7.LTS* ARM_18.12.7.LTS* C6000_8.3.8* ARM_20.2.3.LTS* MSP430_20.2.3.LTS*
    • default
    • Specify length of array in declaration.

      The Compiler issues an error when a constexpr array does not specify length, for example:
      constexpr char fails[] =

      { "string"[0], "string"[1], "string"[2], '\0'};
      error: expression must have a constant value

      There is no error when the length of the array is specified, for example:
      constexpr char works[4] = { "string"[0], "string"[1], "string"[2], '0'}

      ;

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

              Created:
              Updated:
              Resolved: