Changed decltype usage to compile on older GCC.

Closes #3430, over-the-should review by @mlucy.