Repeat command block running: /clear @a minecraft:dirt (Or any other item). In this demo, diamond is used.
Command runs correctly and states it is cleared in the output.
Issue however comes into place when you are in creative, you click item in menu and click hot bar slot. Item is "removed," as you can still see it in the slot but cannot drop it and is not removable.
Duplicate of MC-41113 – If you searched the tracker before creating this report, and were unable to find the indicated ticket, please comment with the keywords you searched for so that the original report can be improved.