[EXT_EP-10401] static constexpr string literals cause compiler to emit duplicate mangled name Created: 15/Jun/21  Updated: 06/Jul/21  Resolved: 06/Jul/21

Status: Fixed
Project: Embedded Software & Tools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Medium
Reporter: TI User Assignee: TI User
Resolution: Fixed Votes: 0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Product: Code Generation Tools
Internal ID: CODEGEN-9023
Forum URL: https://e2e.ti.com/support/processors-group/processors/f/791/t/1009790
Found In Release: 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
Fix In Release: 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*
Affected Platform/Device: default

 Description   

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.


Generated at Wed Apr 09 13:02:17 CDT 2025 using Jira 9.12.17#9120017-sha1:aba4002bcd633f188b6a4bb5dd8a0e1f20b79ee4.