Fix compilation with gcc 4.8. Closes #1756.