the dictionary generation seem to be using header files from the installation directory under certain circumstances. This might break the build if a bad header file is installed, or there is a mixture of old header files in the install directory and new header files in the source or build directory (as happened now when the templated IGradient functions were merged).
To reproduce: the git checkout is in root/, it should be build in root_build/, and installed in root_install/.
This successfully installs ROOT into root_install/. Now modify a header in root_install/ to contain invalid code, and touch the CMakeLists.txt file to trigger a re-run of cmake
ROOT will now no longer compile as the broken file from the installation directory is used when creating the dictionary for MathCore.