Upvote:2
Buddhism concerns itself with the behaviour of people rather than birth status. Refer to MN 98.
In other words, an ethical person who was an illegitimate child is regarded to be superior or happier than an unethical person who was a legitimate child.
Upvote:2
Sex outside marriage without the intention of becoming married may be against the third of the five precepts.
However, there is nothing wrong about the illegitimate child himself (or herself).
From the Sundarika Sutta (SN 7.9) (below), birth (i.e social class or social status) is unimportant. Conduct is important.
Then Sundarika the brahmin went up to the Buddha, and said to him: “Sir, in what caste were you born?”
“Don’t ask about birth, ask about conduct.
For any wood can surely generate fire.
A steadfast sage, even though from a low class family,
is a thoroughbred checked by conscience.
Also please see Legends of Somdet Toh, by Ven. Thanissaro. It chronicles tales from the life of a famous and well-loved monk who lived in Thailand in the 19th century. He is the illegitimate child of a noble man who later became King Rama II. His status as an illegitimate child was apparently known to the monks who ordained him.