Typing is Hard
https://typing-is-hard.ch (https://typing-is-hard.ch)
Quote
Type checking is the process of taking a given program in some programming language and working out whether all variables and expressions have the correct types, i.e. strings are assigned to strings, arithmetic expressions involve only numbers, etc. Some languages also offer type inference, tasking the compiler with the task of figuring out correct types on its own. Depending on a languageās features the type checking and type inference problems range from trivial to undecidable.
Ah, semantic analysis. Hard in c++ due to generics and templates. And c++ is not completely context free so you'll be pulling you hair (literally) if you want to make a C++ compiler.