Slots are a Qt-specific extension of C++. It only compiles after sending the code through Qt’s preprocessor, the Meta-Object Compiler (moc). See http://doc.qt.io/qt-5/moc.html for documentation.
Edit: As Frank points out, moc is only required for linking. The extra keywords are #defined away with the standard preprocessor.