The reason is called type safety. Not all types of expressions make sense in a working program. And type safety means that the compiler will refuse to permit unsafe, invalid, or inappropriate operations.
In the long run, a compiler that rejects such bad code saves the programmer effort, since it takes more time for a programmer to detect a problem without help than it does for a compiler.
C and C++ have a number of type safety features. Other programming languages have more, others less. Which simply means that some styles of programming are more effective in different programming languages.
Warnings are a little less prescriptive form of type safety - they cause the compilers to warn about suspicious things, rather than reject them entirely.