Skip to content

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

Merged
hsutter merged 2 commits into
hsutter:mainfrom
fedapo:error_incomplete_type
Sep 22, 2023
Merged

Fix cppfront incomplete type build error (fix #690)#691
hsutter merged 2 commits into
hsutter:mainfrom
fedapo:error_incomplete_type

Conversation

@fedapo

@fedapo fedapo commented Sep 21, 2023

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

Maybe no_template_args should be a member of primary_expression_node instead.

@hsutter

hsutter commented Sep 21, 2023

Copy link
Copy Markdown
Owner

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

@fedapo

fedapo commented Sep 21, 2023

Copy link
Copy Markdown
Contributor Author

@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