Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with Semicolon Following Member Function #119

Closed
berchn opened this issue Jun 11, 2021 · 1 comment
Closed

Error with Semicolon Following Member Function #119

berchn opened this issue Jun 11, 2021 · 1 comment

Comments

@berchn
Copy link

berchn commented Jun 11, 2021

Class definitions allow for one optional semicolon following a member function (prior to C++14) or an arbitrary amount of semicolons (C++14 and after). Currently, an error occurs when parsing a member function followed by a semicolon:

class C { void f() { return; }; };

translation_unit [0, 0] - [1, 0]
  class_specifier [0, 0] - [0, 33]
    name: type_identifier [0, 6] - [0, 7]
    body: field_declaration_list [0, 8] - [0, 33]
      function_definition [0, 10] - [0, 30]
        type: primitive_type [0, 10] - [0, 14]
        declarator: function_declarator [0, 15] - [0, 18]
          declarator: field_identifier [0, 15] - [0, 16]
          parameters: parameter_list [0, 16] - [0, 18]
        body: compound_statement [0, 19] - [0, 30]
          return_statement [0, 21] - [0, 28]
      ERROR [0, 30] - [0, 31]

This could be addressed by allowing the empty statement in a class definition's body.

@jdrouhard
Copy link
Collaborator

Dupe of #35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants