IDE not allowing D2, D3, etc as pin name

In post #2 of this thread
[Pin names to pin numbers](In post #2 of this thread Pin names to pin numbers

I read: "The Arduino core already carries out a translation internally, so that pin designations (which you call pin numbers, labeled on the Arduino board) are mapped to internal CPU port and port bit. The mapping changes between different Arduino models, which is why you need a board definition file."

I was almost certain that I'd used D2 etc as a direct substitute for '2' etc. But if others also find that my my minimal sketch fails to compile, then I must be mistaken.