jamesjuett / lobster

Interactive Program Visualization Tools
8 stars 3 forks source link

const on a non-member function should give an error #296

Open jamesjuett opened 2 years ago

iteemhe commented 2 years ago

The const-ness of a function is only controlled by receiverType. However, if the function is not a member function, the Declarator.processFunctionDeclarator never checks postfix.const.

Also, there is no corresponding errors for this kind of syntax error. I added a new error.

iteemhe commented 2 years ago

The result of the proposed fix.

Screen Shot 2022-03-09 at 17 19 47

iteemhe commented 2 years ago

I found a bug of this fix. This fix will also report out-line member function definitions, which should not happen. I am looking into it.

I will convert this pull request to draft temporarily.