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

armcl errors on legal constexpr constructor call

    XMLWordPrintable

Details

    • Bug
    • Status: New
    • Medium
    • Resolution: Unresolved
    • Code Generation Tools
    • CODEGEN-4244
    • Hide
      ARM_18.1.0.LTS
      ARM_18.12.0.LTS
      ARM_20.2.0.LTS
      Show
      ARM_18.1.0.LTS ARM_18.12.0.LTS ARM_20.2.0.LTS

    Description

      Here's a cutdown from the above test that causes armcl to generate an error:

      #include <climits>

      struct S07 {
      char m = 0;
      template <class T> constexpr S07(int s, const T a[]) {
      char max = CHAR_MIN;
      int i = 0;
      do

      { char k = a[i]; if ((k >= '0') && (k <= '9') && (k > max)) max = a[i]; }

      while (++i<s);
      m = max;
      }
      };

      int main()

      { constexpr char a07[10] = "hello2027"; constexpr S07 s07(9, a07); constexpr char g07 = s07.m; }

      The definition of 's07' calls the S07 constructor with the constexpr 'a07', but the compiler flags this as an error:

      "p1.c", line 20: error: expression must have a constant value

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: