Saad bin Abu Waqqas reported,

A bedouin came to the Prophet ﷺ and asked, "Messenger of Allah, where is my father?"He replied, "In the Fire."The man asked, "And where is your father?"He said, "Whenever you pass by the grave of a disbeliever, give him the tidings of the Fire."In another narration, the bedouin embraced Islam and said, "The Messenger of Allah ﷺ has burdened me with a tiring task. I never pass by the grave of a disbeliever without giving him the tidings of the Fire."

Azami 3905

Sahih

عن عامر بن سعد عن أبيه

أن أعرابيا، أتى النبي ﷺ فقال: يا رسول الله! أين أبي؟ فقال: في النار قال: فأين أبوك؟ قال: حيثما مررت بقبر كافر فبشره بالنار. وفي رواية: فأسلم الأعرابي وقال: لقد كلفني رسول الله ﷺ تعبا ما مررت بقبر كافر إلا بشرته بالنار.

الأعظمي 3905صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Funerals
Chapter
Visiting graves
Section
One who visits the grave of a disbeliever should not supplicate for him, but rather give him tidings of the Fire
Numbering
Jami al-Kamil 3905 (2nd edition)
Azami 3905