This happens when cmath.h is included after math.h in cpp code. Kudos to Sergey for pointing this out.