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

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Low
    • 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 }; }

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

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

              Created:
              Updated:

                Connection: Intermediate to External PROD System
                EXTSYNC-1099 - Access of const static member throu...
                SYNCHRONIZED
                • Last Sync Date: