diff -up doxygen-1.8.5/src/scanner.l.than doxygen-1.8.5/src/scanner.l --- doxygen-1.8.5/src/scanner.l.than 2017-08-21 18:24:54.220442124 +0200 +++ doxygen-1.8.5/src/scanner.l 2017-08-21 18:25:01.241178886 +0200 @@ -191,6 +191,7 @@ static QCString g_delimiter; static int g_column; static int g_fencedSize=0; +static bool g_nestedComment=0; //----------------------------------------------------------------------------- @@ -6155,23 +6156,27 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSI docBlockName.at(1)='}'; } g_fencedSize=0; + g_nestedComment=FALSE; BEGIN(DocCopyBlock); } "<"{PRE}">" { docBlock+=yytext; docBlockName="
";
                                           g_fencedSize=0;
+                                          g_nestedComment=FALSE;
   					  BEGIN(DocCopyBlock);
   					}
 {CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"dot"|"code")/[^a-z_A-Z0-9]	{ // verbatim command (which could contain nested comments!)
                                           docBlock+=yytext;
 				          docBlockName=&yytext[1];
                                           g_fencedSize=0;
+                                          g_nestedComment=FALSE;
   					  BEGIN(DocCopyBlock);
   					}
 "~~~"[~]*                     {
                                           docBlock+=yytext;
                                           g_fencedSize=yyleng;
+                                          g_nestedComment=FALSE;
                                           BEGIN(DocCopyBlock);
                                         }
 {B}*""                  {
@@ -6179,6 +6184,7 @@ OPERATOR  "operator"{B}*({ARITHOP}|{ASSI
 					  {
 					    docBlock+=yytext;
 					    docBlockName="";
+                                            g_nestedComment=FALSE;
 					    BEGIN(DocCopyBlock);
 					  }
 					  else
@@ -6240,12 +6246,32 @@ OPERATOR  "operator"{B}*({ARITHOP}|{ASSI
                                             docBlock+=indent;
                                           }
   					}
-^{B}*+"*"/{BN}*		{ // start of a comment line
+^{B}*"*"+/{BN}+"*"{BN}*	{ // start of a comment line with two *'s
   					  if (docBlockName=="code")
                                           {
                                             QCString indent;
-                                            indent.fill(' ',computeIndent(yytext,0)-1);
-                                            docBlock+=indent+"*";
+                                            indent.fill(' ',computeIndent(yytext,0));
+                                            docBlock+=indent;
+                                          }
+                                          else
+					  {
+					    REJECT;
+					  }
+  					}
+^{B}*"*"+/{BN}*		{ // start of a comment line with one *
+  					  if (docBlockName=="code")
+                                          {
+                                            QCString indent;
+                                            if (g_nestedComment) // keep * it is part of the code
+                                            {
+                                              indent.fill(' ',computeIndent(yytext,-1));
+                                              docBlock+=indent+"*";
+                                            }
+                                            else // remove * it is part of the comment block
+                                            {
+                                              indent.fill(' ',computeIndent(yytext,0));
+                                              docBlock+=indent;
+                                            }
                                           }
                                           else
 					  {
@@ -6263,6 +6289,14 @@ OPERATOR  "operator"{B}*({ARITHOP}|{ASSI
   					  docBlock+=yytext;
   					}
 "/*"|"*/"|"//"		{
+                                          if (yytext[1]=='*')
+                                          {
+                                            g_nestedComment=TRUE;
+                                          }
+                                          else if (yytext[0]=='*')
+                                          {
+                                            g_nestedComment=FALSE;
+                                          }
   					  docBlock+=yytext;
 					}
 \n			{ // newline