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 splice for slist #64

Closed
wants to merge 2 commits into from
Closed

Fix splice for slist #64

wants to merge 2 commits into from

Conversation

QUvalda
Copy link
Contributor

@QUvalda QUvalda commented Dec 18, 2017

The call of the splice method with iterators leads to an infinite loop inside common_slist_algorithms::get_previous_node

slist lst1 = { 0, 1, 2, 3 };
slist lst2;
lst2.splice(lst2.begin(), lst1, lst1.begin());

expected:
lst1 == { 1, 2, 3 }
lst2 == { 0 }

The call of the splice method with iterators leads to an infinite loop inside common_slist_algorithms::get_previous_node

slist<int> lst1 = { 0, 1, 2, 3 };
slist<int> lst2;
lst2.splice(lst2.begin(), lst1, lst1.begin());

expected:
lst1 == { 1, 2, 3 }
lst2 == { 0 }
@QUvalda
Copy link
Contributor Author

QUvalda commented Dec 18, 2017

#if defined(BOOST_GCC) && (BOOST_GCC >= 50000)
#pragma GCC diagnostic ignored "-Wsized-deallocation"
#endif

void* operator new[](std::size_t count) BOOST_CONTAINER_NEW_EXCEPTION_SPECIFIER
void* operator new[](std::size_t count) BOOST_NOEXCEPT_IF(false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to support older containers that don't have noexcept and avoid warnings that tell us that new should throw std::bad_alloc. What is the problem with current code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. I do not really understand why this commit is displayed here. To fix the splice it has nothing to do. I did this local fix in my repository only to fix the build. But if you look at the Travis CI build (8.2), you can see next error:

libs/container/test/global_resource_test.cpp:42:41: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]

void* operator new[](std::size_t count) BOOST_CONTAINER_NEW_EXCEPTION_SPECIFIER

libs/container/test/global_resource_test.cpp:34:52: note: expanded from macro 'BOOST_CONTAINER_NEW_EXCEPTION_SPECIFIER'

#define BOOST_CONTAINER_NEW_EXCEPTION_SPECIFIER throw(std::bad_alloc)

libs/container/test/global_resource_test.cpp:42:41: note: use 'noexcept(false)' instead

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, can you please open a new issue for this error, adding as much context as you can (compiler, version, flags, etc.) . I'll close this issue as your main commit was already merged. Many thanks for the report and the patch.

@igaztanaga
Copy link
Member

Fixed cherry-picking commit:

ed6c8bd

Many thanks for the report.

@igaztanaga igaztanaga closed this Dec 21, 2017
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