https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102684
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|c++ |tree-optimization --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Richard Biener from comment #1) > ISTR that clang evaluates constexpr declared things opportunistically as > constexpr even when that is not required (your find_gcd<>(ints) call is not > in such a context). I don't think that is the case here. First issue is the standard GCC knows main is only called once so inlining is less. This is expected and can be ignored. Just rename main to f and things will improve right away. The second issue I am trying to figure out but there seems like some missed optimization dealing how many interations the loop is and if the loop is small enough.