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

wrong affinity of pointer-star in function type #126

Open
milahu opened this issue Mar 6, 2023 · 1 comment
Open

wrong affinity of pointer-star in function type #126

milahu opened this issue Mar 6, 2023 · 1 comment

Comments

@milahu
Copy link

milahu commented Mar 6, 2023

source

void* some_function() {}

actual parse tree

translation_unit
  function_definition
    type: primitive_type
    declarator: pointer_declarator
      declarator: function_declarator
        declarator: identifier
        parameters: parameter_list
    body: compound_statement

actual affinity: void (* some_function)
expected affinity: (void *) some_function

actual vs expected

 translation_unit
   function_definition
-    type: primitive_type
-    declarator: pointer_declarator
-      declarator: function_declarator
+    type: compound_type
+      primitive_type
+      pointer_star
+    declarator: function_declarator
         declarator: identifier
         parameters: parameter_list
     body: compound_statement

expected parse tree per clang

{
  "kind": "FunctionDecl",
  "name": "some_function",
  "type": {
    "qualType": "void *()"
  },
  "inner": [
    {
      "kind": "CompoundStmt",
    }
  ]
}

same bug in lezer-parser/cpp#3

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

No branches or pull requests

2 participants