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 predicate's defaulted copy constructor for C++03 while also fixing #276. #290

Conversation

Romain-Geissler-1A
Copy link
Contributor

@Romain-Geissler-1A Romain-Geissler-1A commented Aug 25, 2023

Hi,

This fixes the issue I introduced in #276 (sorry for the breakage).

This time I tested not directly with boost, but using compiler explorer. This is the code I tested:

#include "boost/config.hpp"    

struct predicate {
    BOOST_DEFAULTED_FUNCTION(predicate(const predicate& rhs), : m_ti(rhs.m_ti) {})
    BOOST_DELETED_FUNCTION(predicate & operator=(const predicate & rhs))
public:
    const void * const m_ti;
    /*
    bool operator()(helper_value_type const &rhs) const {
        return m_ti == rhs.first;
    }
    */
    predicate(const void * ti) :
        m_ti(ti)
    {}  
};

void f(const predicate& a)
{
    predicate b(a);
    (void)b;
}

I tried with flags -Wall -Wextra -Werror -std=gnu++03 and -Wall -Wextra -Werror -std=gnu++23, and with both gcc and clang x86_64 (trunk version in both cases). There is no compilation error in all these 4 different variants.

Compiler explorer link for clang/C++03: https://godbolt.org/z/PhPGsMdoM

Cheers,
Romain

@Romain-Geissler-1A
Copy link
Contributor Author

Romain-Geissler-1A commented Aug 25, 2023

Note: given that you use Boost filesystem in your tests (but not in the core library), and given that Boost filesystem 1.84 will drop C++03 support, you may hit some issues testing C++03 in the future.

Same for Boost variant (which is used only in variant.hpp), and potentially other libraries not fully necessary for the core of boost serialization.

@robertramey
Copy link
Member

merged and tested

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.

2 participants