1 // Verify that -fsanitize=vptr downcast instrumentation works properly
2 // inside of constexpr.
4 // { dg-options "-std=c++11 -fsanitize=vptr" }
7 constexpr S() : a(0) {}
10 virtual int v() { return 0; }
14 constexpr T() : b(0) {}
17 virtual int v() { return 1; }
18 constexpr const T *foo() { return (const T *) reinterpret_cast<const S *> (this); }
22 constexpr const T *p = t.foo ();
26 constexpr V() : a(0) {}
29 virtual int v() { return 0; }
34 constexpr W() : b(0) {}
37 virtual int v() { return 1; }
38 constexpr const W<U> *foo() { return (const W<U> *) reinterpret_cast<const V<U> *> (this); }
42 constexpr const W<int> *s = w.foo ();
48 static constexpr const T *p = t.foo ();
49 static constexpr W<U> w;
50 static constexpr const W<U> *s = w.foo ();
54 int x = foo <char> ();