While I would rather use WD40 than nothing, if I had a decent gun oil or lubricant, I'd opt for that first.
Remember that lawsuit originating in Texas where this old feller, while seated in his pick up truck, shot himself in the foot when he jarred his rifle? Well, turns out that for years our unfortunate cohort had been spraying his gun down with WD40 and had never bothered to have it disassembled and cleaned. Like Bjordan740 says, it gums up and sure enough, the surface area between the sear and the safety became like a flat plane. This was the cause of the Remington discharging. Had the unplucky shooter bothered to take it to the gunsmith for regular inspection and cleaning, this could have been prevented.
It took two employees at the factory to separate the action from the stock - and this was after the gun was placed in the vise. Well, Remington lost even though it wasn't their fault. Sadly, the law firm and the negligent owner are both millons richer.
Please no WD40 unless there's absolutely nothing else.