After a recent system upgrade to Qt git dev branch (for upcoming 5.13), kglobalaccel started to fail to build due to problems compiling a moc file. Oddly, all other frameworks in KF5 (except those depending upon kglobalaccel) compiled fine.
I spent some time looking into several potential Qt moc or other issues, but to save you all the time I wasted on it, the essence is that you shouldn't #include "foo.moc" from within a C++ namespace. Previously this would have worked since only symbols relevant to the current C++ namespace were defined.
But with updated Qt, the moc generates files that rely on parts of the C++ standard library being available, and duly includes a line #include <memory>. At the top namespace level this works great. Including <memory> from within our own namespace works less well, producing error messages that cause LLVM to give up early.
I fix by just removing the entry since CMake is automoc'ing anyways. If we need to include the entry then moving it to the end of the file instead would probably work just as well. Note that moc is itself smart enough to capture the namespacing of the class we declare.