Skip to content

Instantly share code, notes, and snippets.

@andrey-malets
Last active December 20, 2015 20:10
Show Gist options
  • Save andrey-malets/b70b0119bdbb92fb4025 to your computer and use it in GitHub Desktop.
Save andrey-malets/b70b0119bdbb92fb4025 to your computer and use it in GitHub Desktop.
malets@ub:~$ cat 1.C
#include <cstdlib>
struct C {
int *ptr;
int& operator*() {
return *ptr;
}
};
int main(void) {
C o = {NULL};
return &*o == NULL;
}
malets@ub:~$ clang++ -fsanitize=undefined -o 1 1.C && ./1
==397678==WARNING: Trying to symbolize code, but external symbolizer is not initialized!
1.C:7:12: runtime error: reference binding to null pointer of type 'int'
malets@ub:~$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment