Parsing C++ is literally undecidable. You can encode arbitrary programs which will emit a syntax error depending on their result.
Here's an example of a program which compiles only if the constant N is prime, and otherwise emits a syntax error: https://stackoverflow.com/questions/14589346/is-c-context-fr....