Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

over 3 years ago

Language

C++

Compiler

gcc 11.1.0

Options
Warnings
Boost 1.76.0
C++11
no pedantic

Author

anonymous

over 3 years ago

$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.76.0/gcc-11.1.0/include -std=c++11
prog.cc: In function 'int main()':
prog.cc:16:20: warning: unnecessary parentheses in declaration of 'q' [-Wparentheses]
   16 |     shared_ptr<int>(q);
      |                    ^~~
prog.cc:16:20: note: remove parentheses
   16 |     shared_ptr<int>(q);
      |                    ^~~
      |                    - -
prog.cc:20:5: warning: unused variable 'foo' [-Wunused-variable]
   20 | int foo = *p; // undefined; the memory to which p points was freed
      |     ^~~
Hello World
q's address 0x7ffd77823b08
p's address 0x7ffd77823b10
new q's address 0x7ffd77823af0
Signal:
Segmentation fault