Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==50429==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7ffcfe02fd30 at pc 0x563667c25166 bp 0x7ffcfe02fa70 sp 0x7ffcfe02fa60 READ of size 8 at 0x7ffcfe02fd30 thread T0 #0 0x563667c25165 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 0x563667c2561b 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 0x563667c24797 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 0x563667c2341e in Book::operator=(Book&&) (/out/package/test+0x2241e) #4 0x563667c208e6 in bookInventory::bookInventory() /in/ex5.cpp:11 #5 0x563667c27b60 in test1() /in/compile/TestFunctions.cpp:28
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 default constructor PASSED