Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==39744==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6130000001b0 at pc 0x55a805e57bca bp 0x7ffddf3e2bf0 sp 0x7ffddf3e2be0 READ of size 8 at 0x6130000001b0 thread T0 #0 0x55a805e57bc9 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const /usr/include/c++/7/bits/basic_string.h:921 #1 0x55a805e58613 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const (/out/package/test+0x23613) #2 0x55a805e578f3 in bool std::operator==<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*) (/out/package/test+0x228f3) #3 0x55a805e578a6 in bool std::operator!=<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*) (/out/package/test+0x228a6
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
Testing the constructor with parameter
JOJ Answer
Testing the constructor with parameter PASSED