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

Access of const static member through pointer is not a constant expression.

    XMLWordPrintable

Details

    • Bug
    • Status: New
    • Medium
    • Resolution: Unresolved
    • Code Generation Tools
    • CODEGEN-4015
    • 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
    • Hide
      The compiler emits an arguably spurious error on an access of a const static data member through a pointer when a constant expression is required. While gcc allows this silently, both the TI compiler and clang emit errors in stricter modes.

      struct C { const static int m; };
      const int C::m = 4;
      C c, *cp = &c;
      int main(void)
      {
      struct S02 {
      int x : cp->m; // error, not a constant expression
      };
      }
      Show
      The compiler emits an arguably spurious error on an access of a const static data member through a pointer when a constant expression is required. While gcc allows this silently, both the TI compiler and clang emit errors in stricter modes. struct C { const static int m; }; const int C::m = 4; C c, *cp = &c; int main(void) { struct S02 { int x : cp->m; // error, not a constant expression }; }

    Description

      Access of const static member through pointer is not a constant expression.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: