Author Topic: enum member called auto confuses slick  (Read 196 times)

Graeme

  • Senior Community Member
  • Posts: 2289
  • Hero Points: 300
enum member called auto confuses slick
« on: February 18, 2019, 01:11:46 am »
Not sure if this is a bug
enum class something : uint8_t {
   one,
   auto,
   two,
   three
};

because of auto, push-tag on something::three doesn't work.
Could be illegal to use auto there, I don't know.
slick 23.0.0.11



Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2633
  • Hero Points: 406
Re: enum member called auto confuses slick
« Reply #1 on: February 18, 2019, 05:03:55 pm »
It is certainly not portable.  Clang compiler flagged it as an error.  However, this is something our parser could work around.  We have a short list of keywords we allow as enumerator names for ANSI-C compatibility, auto could be added to that list.  Because "auto" is an old keyword, I am really surprised any compiler would allow that.

Graeme

  • Senior Community Member
  • Posts: 2289
  • Hero Points: 300
Re: enum member called auto confuses slick
« Reply #2 on: February 18, 2019, 08:35:27 pm »
I had a bunch of names that I got from a spec and pasted them into my code.  I don't think I got as far as compiling.  I see that using reserved words as identifiers is illegal.  Normally I try not to use any English words as identifiers anywhere but I briefly made an exception for the scoped enum because you have to specify the class name to use them.  However I've scrapped the class name and added a suffix because GCC forced me to cast the names to int to let me use them as values.