https://godbolt.org/z/sKob5YhW3 You can uncomment either 1) or 2) and it will stop inlining. Seems to be a bug to me. Happens in both C and C++