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

C++ constructor outside of class is not (always) recognised as constructor #1201

Closed
oxisto opened this issue Jun 12, 2023 · 0 comments · Fixed by #1199
Closed

C++ constructor outside of class is not (always) recognised as constructor #1201

oxisto opened this issue Jun 12, 2023 · 0 comments · Fixed by #1199
Labels
cxx Related to C/C++ language parsing

Comments

@oxisto
Copy link
Member

oxisto commented Jun 12, 2023

It seems that a constructor outside of a class is only recognised if the class is known. Otherwise, it is recognised as a method declaration with an empty type - which is slightly off.

Example code:

int main() {
  SomeClass* c = new SomeClass();
}

SomeClass::SomeClass() {
}

My suggestions would be that the following must be present in order for it to be recognised as a constructor:

  • empty type declaration
  • parent name == local name
@oxisto oxisto added the cxx Related to C/C++ language parsing label Jun 12, 2023
@oxisto oxisto linked a pull request Jun 14, 2023 that will close this issue
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cxx Related to C/C++ language parsing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant