cppfront icon indicating copy to clipboard operation
cppfront copied to clipboard

fix(cpp1): account for initializers of members lowered as bases

Open JohelEGP opened this issue 2 years ago • 3 comments

Resolves #422.

Testing summary.
100% tests passed, 0 tests failed out of 704

Total Test time (real) = 104.69 sec
Acknowledgements.

JohelEGP avatar May 30 '23 21:05 JohelEGP

With commit 379ae0311f177ea42517cb07520c4f804f4396b6, a @struct lowers to an aggregate. If an @struct type also has members lowered as bases, it's necessary to continue emitting those SMFs. -- https://github.com/hsutter/cppfront/issues/422#issuecomment-1595827494

JohelEGP avatar Jun 17 '23 18:06 JohelEGP

I suppose the only reasonable option is to queue an error if emitting SMFs is suppressed.

I can't reliably lower an initializer to the *_as_base's data member's initializer, as it could only be valid in the derived type's scope (e.g., uses the type's template parameter or a previous data member).

I thought about also emitting actual bases to *_as_struct_base, but besides being equally problematic to move the lowered initializer, the change from a direct base class to an indirect one should come with its own set of problems.

I wonder if the error falls under the banner of "(temporary alpha limitation)".

JohelEGP avatar Jun 18 '23 01:06 JohelEGP

Hi! Sorry it took me so long to get to this one... this one looks like it might be out of date, should I close it for now and you can reopen this or create a new PR when it's ready? Again, my apologies for not keeping up.

hsutter avatar Oct 31 '24 03:10 hsutter