https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120395
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This isn't actually related to the builtin, we get the same thing for any
always_inline function that returns a constant:
void x(int);
[[gnu::always_inline]]
inline bool always_true() { return true; }
struct Iter
{
typedef int value_type;
int& operator*() const;
Iter& operator++();
bool operator!=(const Iter&) const;
};
void f(Iter first, Iter last)
{
if (__is_trivial(Iter::value_type))
if (always_true())
return;
// unreachable dead code!
for (; first != last; ++first)
x(*first);
}
So there's probably a dup of this.