https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123227
--- Comment #1 from Dave <dave.w4 at coalgebraic dot com> ---
In the sample code the Data struct is unnecessary. The following simpler
code also exhibits the problem:
enum Val { zero = 0 };
inline Val&
operator|=(Val& a, Val b)
{
return a = static_cast<Val>(static_cast<int>(a) | static_cast<int>(b));
}
struct Link {
Val get_vals();
Val val;
Link* next;
};
Val
Link::get_vals()
{
Val v = zero;
for (Link* l = this; l; l = l->next)
v |= l->val;
return v;
}
Val
get_vals(Link* l)
{
Val v = zero;
for (; l; l = l->next)
v |= l->val;
return v;
}
int
main(int, char**)
{
return get_vals(0);
}