Skip to content
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

Fix regression because of adding copy constructor #50

Merged
merged 4 commits into from
Feb 20, 2023
Merged

Conversation

dcleblanc
Copy link
Owner

The change to add a copy constructor from SafeInt to SafeInt caused a regression in some versions of gcc. See MoveRegression() in CompileTest.cpp. It's not clear just why adding a copy constructor might cause this problem, particularly only in some compilers.

The problem came in when running clang with -Wall -Wextra, which caused warnings about a user-supplied assignment operator which didn't have a matching copy constructor. Adding a copy constructor seemed like the right approach, but it caused this regression.

In addition, adding a move constructor and move assignment operator was also tried, and it didn't help. In order to avoid the problem, it seems that none of:

copy constructor
move constructor
assignement operator
move assignment operator

can exist. It's fine that they don't exist, the defaults for all of these do the right thing. In addition, declaring these operators as = default also resulted in errors.

In addition, while clang was building with std=c++17, gcc was not. That's been corrected to ensure the regression test actually works (and general goodness, tests should be equivalent).

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.

None yet

1 participant