Repository: doxygen/doxygen (language: python)

Issue:
Documentation for enum via the @enum command is missed if the @ingroup command is also used
**Describe the bug**
Trying to place an enum in a group via the `@ingroup` command results in the documentation for said enum being completely missed by Doxygen if the enum was documented via the `@enum` command.
```
foo.cpp:6: warning: Documentation for undefined enum 'MyEnum' found.
...

foo.h:6: warning: Member MyEnum (enumeration) of namespace NS is not documented.
```

**Expected behavior**
Enums can be placed in a group regardless of how they're documented.

**Screenshots**
N/A

**To Reproduce**
Check MRE.
[Enum in Group MRE.zip](https://github.com/doxygen/doxygen/files/11876752/Enum.in.Group.MRE.zip)

**Version**
Latest stable.
1.9.7 (a2f34e1ed90f83713dc347b5134920f32c455d46)
Windows x64

**Additional context**
The namespace in the MRE is not required to produce the bug, but was included since only a warning is fired without it.

The MRE is correctly processed in  versions <= 1.9.6.



Discussion / hints:
Had a moment to delve a little deeper.

Bisect shows the issue was introduced with bd99649d9d2d15cb3c1c7b53167365b79a6aaa5b.
Maybe @sebhub can shine a light on it (as he was the author of the patch providing apparent the problem)
Thanks for the notification. I will have a look at this after my summer holidays in late September.

Fix patch:
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index 69e3020a118..4cf20c34d6c 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -7529,8 +7529,8 @@ static void findEnumDocumentation(const Entry *root)
 
     if (!name.isEmpty())
     {
-      bool found = FALSE;
-      if (root->groups.empty())
+      bool found = tryAddEnumDocsToGroupMember(root, name);
+      if (!found)
       {
         MemberName *mn;
         if (cd)
@@ -7576,10 +7576,6 @@ static void findEnumDocumentation(const Entry *root)
           }
         }
       }
-      else
-      {
-        found = tryAddEnumDocsToGroupMember(root, name);
-      }
       if (!found)
       {
         warn(root->fileName,root->startLine,


Test patch:
diff --git a/testing/100/group___a.xml b/testing/100/group___a.xml
index 65c3b6f525b..e4fd32ac269 100644
--- a/testing/100/group___a.xml
+++ b/testing/100/group___a.xml
@@ -35,7 +35,7 @@
         </detaileddescription>
         <inbodydescription>
         </inbodydescription>
-        <location file="100_a.c" line="22" column="1" bodyfile="100_a.c" bodystart="22" bodyend="32"/>
+        <location file="100_a.c" line="24" column="1" bodyfile="100_a.c" bodystart="24" bodyend="34"/>
       </memberdef>
     </sectiondef>
     <sectiondef kind="typedef">
@@ -52,7 +52,7 @@
         </detaileddescription>
         <inbodydescription>
         </inbodydescription>
-        <location file="100_a.c" line="72" column="16" bodyfile="100_a.c" bodystart="72" bodyend="-1"/>
+        <location file="100_a.c" line="74" column="16" bodyfile="100_a.c" bodystart="74" bodyend="-1"/>
       </memberdef>
     </sectiondef>
     <sectiondef kind="var">
@@ -69,7 +69,7 @@
         </detaileddescription>
         <inbodydescription>
         </inbodydescription>
-        <location file="100_a.c" line="79" column="5" bodyfile="100_a.c" bodystart="79" bodyend="-1"/>
+        <location file="100_a.c" line="81" column="5" bodyfile="100_a.c" bodystart="81" bodyend="-1"/>
       </memberdef>
       <memberdef kind="variable" id="group___a_1gabf2bc2545a4a5f5683d9ef3ed0d977e0" prot="public" static="yes" mutable="no">
         <type>int</type>
@@ -84,7 +84,7 @@
         </detaileddescription>
         <inbodydescription>
         </inbodydescription>
-        <location file="100_a.c" line="86" column="12" bodyfile="100_a.c" bodystart="86" bodyend="-1"/>
+        <location file="100_a.c" line="88" column="12" bodyfile="100_a.c" bodystart="88" bodyend="-1"/>
       </memberdef>
     </sectiondef>
     <sectiondef kind="func">
@@ -104,7 +104,7 @@
         </detaileddescription>
         <inbodydescription>
         </inbodydescription>
-        <location file="100_a.c" line="46" column="13" bodyfile="100_a.c" bodystart="46" bodyend="46"/>
+        <location file="100_a.c" line="48" column="13" bodyfile="100_a.c" bodystart="48" bodyend="48"/>
       </memberdef>
       <memberdef kind="function" id="group___a_1ga5806fbe7d2114068e8085236b6f8098d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
         <type>void</type>
@@ -122,7 +122,7 @@
         </detaileddescription>
         <inbodydescription>
         </inbodydescription>
-        <location file="100_a.c" line="53" column="6" bodyfile="100_a.c" bodystart="53" bodyend="53"/>
+        <location file="100_a.c" line="55" column="6" bodyfile="100_a.c" bodystart="55" bodyend="55"/>
       </memberdef>
     </sectiondef>
     <sectiondef kind="define">
@@ -137,7 +137,7 @@
         </detaileddescription>
         <inbodydescription>
         </inbodydescription>
-        <location file="100_a.c" line="39" column="9" bodyfile="100_a.c" bodystart="39" bodyend="-1"/>
+        <location file="100_a.c" line="41" column="9" bodyfile="100_a.c" bodystart="41" bodyend="-1"/>
       </memberdef>
     </sectiondef>
     <briefdescription>
diff --git a/testing/100/group___d.xml b/testing/100/group___d.xml
new file mode 100644
index 00000000000..4efdc5f22a9
--- /dev/null
+++ b/testing/100/group___d.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="" xml:lang="en-US">
+  <compounddef id="group___d" kind="group">
+    <compoundname>D</compoundname>
+    <title>D</title>
+    <innernamespace refid="namespace_n_s">NS</innernamespace>
+    <sectiondef kind="enum">
+      <memberdef kind="enum" id="group___d_1gaa48c7d518127686d87b3be640e03f505" prot="public" static="no" strong="no">
+        <type/>
+        <name>ED</name>
+        <qualifiedname>NS::ED</qualifiedname>
+        <enumvalue id="group___d_1gaa48c7d518127686d87b3be640e03f505a94ee7e7f82d8a53f2853783964f93769" prot="public">
+          <name>ED1</name>
+          <briefdescription>
+          </briefdescription>
+          <detaileddescription>
+            <para>Enumerator ED1. </para>
+          </detaileddescription>
+        </enumvalue>
+        <enumvalue id="group___d_1gaa48c7d518127686d87b3be640e03f505afbd72f13da84f11a306dcbadbf382543" prot="public">
+          <name>ED2</name>
+          <briefdescription>
+          </briefdescription>
+          <detaileddescription>
+            <para>Enumerator ED2. </para>
+          </detaileddescription>
+        </enumvalue>
+        <briefdescription>
+        </briefdescription>
+        <detaileddescription>
+          <para>Enum ED. </para>
+        </detaileddescription>
+        <inbodydescription>
+        </inbodydescription>
+        <location file="more_100_d.cpp" line="3" column="3" bodyfile="more_100_d.cpp" bodystart="3" bodyend="6"/>
+      </memberdef>
+    </sectiondef>
+    <briefdescription>
+    </briefdescription>
+    <detaileddescription>
+    </detaileddescription>
+  </compounddef>
+</doxygen>
diff --git a/testing/100/structs.xml b/testing/100/structs.xml
index bb098ed4fea..47797ac93f8 100644
--- a/testing/100/structs.xml
+++ b/testing/100/structs.xml
@@ -16,7 +16,7 @@
         </detaileddescription>
         <inbodydescription>
         </inbodydescription>
-        <location file="100_a.c" line="64" column="7" bodyfile="100_a.c" bodystart="64" bodyend="-1"/>
+        <location file="100_a.c" line="66" column="7" bodyfile="100_a.c" bodystart="66" bodyend="-1"/>
       </memberdef>
     </sectiondef>
     <briefdescription>
@@ -25,7 +25,7 @@
     <detaileddescription>
       <para>More for s in <ref refid="100__a_8c" kindref="compound">100_a.c</ref> from <ref refid="more__100__c_8c" kindref="compound">more_100_c.c</ref>. </para>
     </detaileddescription>
-    <location file="100_a.c" line="60" column="1" bodyfile="100_a.c" bodystart="60" bodyend="65"/>
+    <location file="100_a.c" line="62" column="1" bodyfile="100_a.c" bodystart="62" bodyend="67"/>
     <listofallmembers>
       <member refid="structs_1afbd4a62a1d1e5d85ea3fcb5954434f29" prot="public" virt="non-virtual">
         <scope>s</scope>
diff --git a/testing/100_a.c b/testing/100_a.c
index 836c2098a67..1fc972cfddb 100644
--- a/testing/100_a.c
+++ b/testing/100_a.c
@@ -1,9 +1,11 @@
 // objective: test documentation entry association with groups
 // input: more_100_b.c
 // input: more_100_c.c
+// input: more_100_d.cpp
 // check: group___a.xml
 // check: group___b.xml
 // check: group___c.xml
+// check: group___d.xml
 // check: structs.xml
 
 /**
diff --git a/testing/more_100_d.cpp b/testing/more_100_d.cpp
new file mode 100644
index 00000000000..2eb4755853e
--- /dev/null
+++ b/testing/more_100_d.cpp
@@ -0,0 +1,42 @@
+namespace NS
+{
+  enum ED {
+    ED1,
+    ED2
+  };
+}
+
+/**
+ * @namespace NS
+ *
+ * @ingroup D
+ *
+ * Namespace NS.
+ */
+
+/**
+ * @defgroup D D
+ */
+
+namespace NS
+{
+/**
+ * @enum ED
+ *
+ * @ingroup D
+ *
+ * Enum ED.
+ */
+
+/**
+ * @var ED ED::ED1
+ *
+ * Enumerator ED1.
+ */
+
+/**
+ * @var ED ED::ED2
+ *
+ * Enumerator ED2.
+ */
+}