If you want to test that something doesn't compile, you just try to compile it and it either will succeed or fall. UB is a runtime thing, so that's not relevant to this point.
You mean including code snippets of not compiling code in the automated(!) tests and compiling them from there?
Hm, That makes sense.
Anybody know a good framework for this? I can imagine that supporting different compilers output isn't a trivial thing that one should have to rebuild themselves.
Btw: The undefined behaviour question was meant to be unrelated to the "not compiling" one.
Offhand, I would just use whatever CI tool you're already using to test various compiler/OS combinations and then just write a bash script to run that compiles a test file (given as an argument) and exits with the opposite exit code that the compiler gives (i.e. 0 for failure, 1 for success).