Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==52807==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7fffcd0f6880 at pc 0x55fcced9a166 bp 0x7fffcd0f6540 sp 0x7fffcd0f6530 READ of size 8 at 0x7fffcd0f6880 thread T0 #0 0x55fcced9a165 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const /usr/include/c++/7/bits/basic_string.h:176 #1 0x55fcced9a61b in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const /usr/include/c++/7/bits/basic_string.h:211 #2 0x55fcced99797 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) (/out/package/test+0x23797) #3 0x55fcced9841e in Book::operator=(Book&&) (/out/package/test+0x2241e) #4 0x55fcced95e0a in bookInventory::bookInventory(int) /in/ex5.cpp:25 #5 0x55fcced9ceb9 in test2() /in/compile/TestFunctions.cpp:
Hints
Your answer may be identical to the JOJ answer in the first several lines.
However, the main problem you meet now is Runtime Error. And the exit code of your program is 1, which should be 0.
Please double check your code to solve this problem and try again.
Your Answer
JOJ Answer
Testing the constructor with parameter PASSED