https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123354
Bug ID: 123354
Summary: ICE with nested structures and sizeof of constexpr
variable
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: antoshkka at gmail dot com
Target Milestone: ---
The following code causes ICE since GCC-14:
template<typename T>
void foo() {
static constexpr char string[] = "mew";
struct s1_t {
struct s2_t {
int dummy { 0 };
char* ptr { static_cast<char*>(::operator new(sizeof(string)))};
} s2;
} object;
};
int main() {
foo<void>();
}
Godbolt playground: https://godbolt.org/z/WE1hz4fn5