enum is this a bug?

I step through an array of pin numbers to scan multiple input with non sequential pin numbers.

I set this up using enum for scanning a bunch of pushbuttons.

enum buttonNames          { Button0, Button1, Button2, Button3, Button4, Button5, Button6, Button7};
const int buttonPinNo[] = {   1,       0,       2,      4,      3,        9 ,      6,         7  };

This first example works fine.

For a different project I wanted to use shorter names for the buttons and wrote it this way:

enum      buttonNames   { PB1, PB2, PB3, PB4, PB5 };
const int buttonPin[] = { 1,   0,   2,   3,    4 };

It gives an error for the labels PB1,PB2, etc. Any other form is acceptable Is upper case PB followed by a single numeral a keyword of some kind?

The following combinations do not cause an error

enum      buttonNames   { Pb1, pB2, pb3, PBa4, PB45 };
const int buttonPin[] = { 1,   0,   2,   3,    4 };

It is an easy work around but I am curious why that particular combination of characters does not work.

It gives an error for the labels PB1,PB2, etc.

There’ll be a big clue in the error message.

If that clue isn't enough, then beware generally of using short names where the letters are in capitals and which could conflict with existing system macro names.

The question is, do these conflict with some system names? The error message does not indicate a conflict but looks like it doesn't recognize an identifier but it is the message given when a keyword is used. It is only a problem when the digit is 0 thru 7.

Just in case something else in my code was causing a problem I created the following empty sketch:

enum names { PB1, PB2,  PB3 };
void setup() {
  // put your setup code here, to run once:
void loop() {
  // put your main code here, to run repeatedly:

Here is the error.

Enum_Test:4:14: error: expected identifier before numeric constant
enum names { PB1, PB2, PB3 };

Try Serial.print( PB1 ) ; and see what you get without defining PB1.

The format of enum the compiler thinks you are attempting is:

enum names { MYFIRST = 1 , MYSECOND = 2 .... } ;

It has resolved PB1 to a numeric constant (e.g. 1 ) and is missing the identifier ( e.g. MYFIRST ) .