yin parser BUGFIX enum statement appearance check

Similar as previous bugfix for bits - enum statement(s) can appear only
(and at least one MUST appear) when the type from which it is derived
is built-in enumeration type. When the type is only derived from the
enumerationbits built-in type in more steps, enum statement is prohibited.
diff --git a/src/parser/yin.c b/src/parser/yin.c
index 78f3436..304bfa6 100644
--- a/src/parser/yin.c
+++ b/src/parser/yin.c
@@ -1107,14 +1107,16 @@
                 goto error;
             }
         }
-        if (!type->info.enums.count) {
-            if (type->der->type.der) {
-                /* this is just a derived type with no enum specified/required */
-                break;
-            }
+        if (!type->der->type.der && !type->info.enums.count) {
+            /* type is derived directly from buit-in enumeartion type and enum statement is required */
             LOGVAL(VE_MISSSTMT2, LOGLINE(yin), "enum", "type");
             goto error;
         }
+        if (type->der->type.der && type->info.enums.count) {
+            /* type is not directly derived from buit-in enumeration type and enum statement is prohibited */
+            LOGVAL(VE_INSTMT, LOGLINE(yin), "enum");
+            goto error;
+        }
 
         type->info.enums.list = calloc(type->info.enums.count, sizeof *type->info.enums.list);
         v = 0;