We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The union metaclass currently does not provide copy constructors nor does it prevent the user from defining them, causing incorrect copy semantics.
To Reproduce
test: @union type = { operator=: (out this) = {} operator=: (out this, that) = {} name: std::string; } main: () -> int = { var: test = (); var.set_name(""); var2 := var; }
Commands:
./cppfront test.cpp2 g++11.3 -I ./include/ -std=c++20 test.cpp ./a.out
Expected result: Code either fails to compile due to provided copy constructor or copy semantics are correctly implemented.
Actual result/error: Memberwise copy is performed, creating an invalid object.
free(): invalid pointer Aborted
The text was updated successfully, but these errors were encountered:
Good catch, thanks!
Sorry, something went wrong.
083c8a0
Add default ctor and copying/moving to union, closes hsutter#770
union
11996ee
No branches or pull requests
The union metaclass currently does not provide copy constructors nor does it prevent the user from defining them, causing incorrect copy semantics.
To Reproduce
Commands:
Expected result:
Code either fails to compile due to provided copy constructor or copy semantics are correctly implemented.
Actual result/error:
Memberwise copy is performed, creating an invalid object.
The text was updated successfully, but these errors were encountered: