Hello
I believe I have found a bug in the TI C6000 CGT (still present in 8.3.10).
The following code produces assembler error E0300:
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();
}
(sorry about the formatting, insert code doesn't seem to work correctly)
The problem disappears
- if I remove one of the calls to x1() or x2() from f(), or
- if I remove the constexpr-ness from x1() and x2(), or
- if I change the type of "name" to e.g. int (and initialize it accordingly)
No other compiler that I tried seems to take issue with the code.
Kind regards
Markus
EDIT: naming the strings first (i.e. creating a constexpr const char name1[] = "x1"; etc) and using pointers to those names also compiles.