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

static constexpr string literals cause compiler to emit duplicate mangled name

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-9023
    • Hide
      C7000_1.4.0.LTS
      C6000_8.3.0
      MSP430_20.2.0.LTS
      ARM_18.12.0.LTS
      MSP430_21.6.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_21.6.0.LTS MSP430_18.12.0.LTS ARM_20.2.0.LTS
    • Hide
      MSP430_20.2.6.LTS*
      MSP430_18.12.9.LTS*
      C6000_8.3.11*
      C7000_1.4.3.LTS*
      ARM_20.2.6.LTS*
      ARM_18.12.9.LTS*
      MSP430_21.6.1.LTS*
      Show
      MSP430_20.2.6.LTS* MSP430_18.12.9.LTS* C6000_8.3.11* C7000_1.4.3.LTS* ARM_20.2.6.LTS* ARM_18.12.9.LTS* MSP430_21.6.1.LTS*
    • default

      The attached file.cpp has these lines in it ...

      struct X {
          const char *name;
      
          constexpr X(const char *n) : name(n) {}
      
          static constexpr X x1() { return X("x1"); }
          static constexpr X x2() { return X("x2"); }
      };
      
      void f()
      {
          X::x1();
          X::x2();
      }
      

      Build it ...

      % cl6x -s file.cpp
      "file.asm", ERROR!   at line 58: [E0300] Symbol _ZZ1fvEs has already been
                                               defined
                      .bits           0x78,8
      
      1 Assembly Error, No Assembly Warnings
      
      Errors in Source - Assembler Aborted
      
      >> Compilation failure
      

      Inspect file.asm to see that two strings "x1" and "x2" are created, but they both have the same label _ZZ1fvEs.

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

              Created:
              Updated:
              Resolved: