-
Notifications
You must be signed in to change notification settings - Fork 556
[C++]: Static constexpr fields in CppGenerator #355
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
Conversation
Limited to HeaderStructure data
|
Please revert this patch. It defines static member variables which causes linking issues. |
|
Can you possibly be more specific/ provide example/diagnostic? At least more context? |
These needs to be in a .cpp file otherwise two .o files that include the SBE flyweight won't link due to multiple definitions of these static members. |
|
I created a GeneratedStubExample2.cpp that also includes the Car flyweight. If you try to link GeneratedStubExample.cpp and GeneratedStubExample2.cpp you get this error: |
|
Added issue #367 to track this. |
|
It makes sense that the definitions would be guarded within one object file, yet collide if included in multiple and then linked into one. I am struggling to understand a benefit of such diamond dependency use case. I am sure there can be a reason (yet I am curious to learn, if you do not mind), and it aside, what may be options for keeping Considering that changing Any other thoughts? |
|
Instead of hopping between the issues, would it be OK to reopen the #353? My preference is to keep reasoning in one place. |
|
This is one solution: |
It's not a diamond dependency. I just have two parts of a program using the same flyweight. With the new codegen that is not possible. |
|
Another option might be to only add the new statics when it is C++11 and can be constexprs. |
|
Ok, sorry, long day. Makes sense. Moving to the issue thread. |
|
Just add |
The pull request addresses the issue #353 and is limited to HeaderStructure data in the stubs.