y3c-stl 0.4.0
Friendly C++ STL wrapper with automatic stacktrace
Loading...
Searching...
No Matches
shared_ptr-null.cc

‍example output:

y3c-stl terminated: undefined behavior detected (ub_access_nullptr)
at y3c::shared_ptr<int>::operator*(): attempted to access the value of nullptr.
Stack trace (most recent call first):
#0 0x000000000000460b in main at /home/runner/work/y3c-stl/y3c-stl/build/../examples/shared_ptr-null.cc:5:13
3: int main() {
4: y3c::shared_ptr<int> a = nullptr;
5: int v = *a;
6: }
#1 0x0000000000029d8f at /lib/x86_64-linux-gnu/libc.so.6
#2 0x0000000000029e3f in __libc_start_main at /lib/x86_64-linux-gnu/libc.so.6
#3 0x0000000000004504 in _start at /home/runner/work/y3c-stl/y3c-stl/build/examples/y3c-example-shared_ptr-null
所有権を共有するスマートポインタ (std::shared_ptr)
Definition shared_ptr.h:28
y3c::wrap_ref< E > operator*() const
要素の間接参照
Definition shared_ptr.h:186
Definition array.h:8
#include <y3c/memory>
int main() {
y3c::shared_ptr<int> a = nullptr;
int v = *a;
}