gcc/testsuite/g++.dg/ubsan/static-init-1.C
raw| 1 | // PR sanitizer/66190 |
| 2 | // { dg-do compile } |
| 3 | // { dg-options "-fsanitize=null -std=c++11" } |
| 4 | |
| 5 | class A { |
| 6 | public: |
| 7 | void fn1 (int); |
| 8 | }; |
| 9 | |
| 10 | class G { |
| 11 | ~G (); |
| 12 | A t; |
| 13 | virtual void fn2 () { |
| 14 | static int a; |
| 15 | static int &b = a; |
| 16 | static int &c (a); |
| 17 | static int &d {a}; |
| 18 | t.fn1 (b); |
| 19 | } |
| 20 | }; |
| 21 | G ::~G () {} |