https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112296
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Barry Revzin from comment #0) > inline int direct(Span span) { > return __builtin_constant_p(span.size()); > } > > inline int indirect(Span span) { > size_t s = span.size(); > return __builtin_constant_p(s); > } If the problem is that bcp is limited by inlining, you'd think that the first one would be more likely to work. It does less. Clearly inlining can see through the member function, because in 'indirect' it can propagate its return value through 's' and to the bcp call. But in 'direct' the return value is somehow not constant when used directly. It is only constant if propagated through a local variable. That seems like an unnecessary limitation.