If you die and switch to creative mode using the F3+F4 shortcut to switch to creative or spectator mode at the same time, you will die as usual. However, your inventory will show creative or spectator mode. (This requires extremely precise timing so it is very hard to replicate)
The chat will show:
(death message)
Set own game mode to Creative/Spectator
Attachments
Comments 3
The switching of gamemode comes after your death, so it makes sense. You aren't dying in creative, but rather switching to it after dying.
Can confirm
[media]