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

Library fails to compile with gcc14 #605

Open
colbysparks opened this issue Jul 30, 2024 · 0 comments · May be fixed by #606
Open

Library fails to compile with gcc14 #605

colbysparks opened this issue Jul 30, 2024 · 0 comments · May be fixed by #606

Comments

@colbysparks
Copy link

colbysparks commented Jul 30, 2024

Compiling a simple program which includes rx-includes.hpp fails with gcc 14.

#include <iostream>
#include "rxcpp/rx-includes.hpp"

int main() {
    std::cout << "wow" << std::endl;
    return 0;
}

The issue appears to be that the assignment operators of on_next_notification and on_error_notification attempt to modify a private const field here and here, respectively. Apparently this compiles in older versions of gcc because it was simply not attempting to check assignments inside of templates, unless the templates are being used. With this change in gcc 14 however, simple assignments are now checked even inside of templates. This would be my guess as to why this code now fails to compile.

The fix seems to be to simply delete the assignment operator for on_next_notification and on_error_notification, as the two structs are only ever instantiated as shared_ptr so it is not needed. In any case, compilation will fail with older versions of gcc if a user writes code which causes a variant of the assignment operator template to be generated.

Edit: The project I've been working on uses RxCpp v4.1.1, but apparently the const declaration of the T value field of on_next_notification has been removed on master.

@colbysparks colbysparks linked a pull request Jul 30, 2024 that will close this issue
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 a pull request may close this issue.

1 participant