Skip to content

Fix cppfront incomplete type build error (fix #690) #691

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

Merged
merged 2 commits into from
Sep 22, 2023

Conversation

fedapo
Copy link
Contributor

@fedapo fedapo commented Sep 21, 2023

I'm submitting an effort to fix the problem.
While it should work, the function template_arguments() returns a non-const reference to a static object that should stay empty, yet it could potentially be populated by the caller of the function. I'm not entirely ok with this, but I haven't dug any deeper, could the reference be changed to point to a const object?

UPDATE:
Upon @hsutter suggestion I changed the empty vector to be a const global. The template_arguments() functions now return a const ref.
Again, this was my attempt to fix this issue. Should a better implementation be provided, I'm ok with that.

@JohelEGP
Copy link
Contributor

Maybe no_template_args should be a member of primary_expression_node instead.

@hsutter
Copy link
Owner

hsutter commented Sep 21, 2023

I was about to make it a global static, and fix the accessors to return const& (the missing const was just an oversight).

@fedapo
Copy link
Contributor Author

fedapo commented Sep 21, 2023

@hsutter Yes, I took a second look and I was about to try an change all accessors. I'm ok with closing this ticket and let you do it or continue with your suggestion. Your call.
Thanks for the feedback.

* Change template_arguments() functions to return a const ref
* Make the empty vector of args a const global
@hsutter hsutter merged commit efd185f into hsutter:main Sep 22, 2023
zaucy pushed a commit to zaucy/cppfront that referenced this pull request Dec 5, 2023
* Fix cppfront incomplete type build error (fix hsutter#690)

* Improve previous implementation

* Change template_arguments() functions to return a const ref
* Make the empty vector of args a const global
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

Successfully merging this pull request may close these issues.

3 participants