Enumerator with type alias name

It seems that PGI Fortran 10.5 doesn’t support type alias name for Enumerator, isn’t it?
This is how I define
This is okay

ENUM, BIND(C) 
  ENUMERATOR :: Sun = 1, Mon, Tue, Wed, Thur
END ENUM

But this doesn’t work

ENUM, BIND(C) :: Day
  ENUMERATOR :: Sun = 1, Mon, Tue, Wed, Thur
END ENUM Day

Thanks,
Tuan

Hi,

The first example is correct. I don’t think the second would work with standard Fortran as far as I understand. Is there a new standard or extension we should be aware of?

Hongyon

I’m not sure if this is the standard or just an extension, yet it provide a convenient way of using a preferred name for the data type. This is the website

http://docs.cray.com/books/S-3692-51/html-S-3692-51/z970507905n9123.html

BTW, may I ask how to define a variable to get an enumerator constant. is this correct?

INTEGER :: nameofday

Or should I specify any KIND parameter for it.

Thanks,
Tuan

enum is just a set of constant integer, therefore you can treat it as integer.

To make sure you get the same kind,

You can do :

integer(kind(Mon))::nameofday

“Mon” is from your enum.


Hongyon

Thanks Hongyon,
Is it possible that PGI add type name alias to its set of features.

Tuan.