First:
int *p = new int;
Second:
class A{};
A *pa = new A;
How does new and compiler determines when to call constructor? In first case compiler does not generate code to call constructor of p and in second case it generates code to call constructor of A. Which mechanism is used to make such choice?
The compiler knows that A is a class, because it has seen the class declaration, so it uses the synthesised default constructor. It knows an int is an int, because the language grammar says it is.