xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/vtordisp-mode.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple i686-pc-win32 -std=c++11 -vtordisp-mode=0 -DVTORDISP_MODE=0 %s -verify
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple i686-pc-win32 -std=c++11 -vtordisp-mode=1 -DVTORDISP_MODE=1 %s -verify
3*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple i686-pc-win32 -std=c++11 -vtordisp-mode=2 -DVTORDISP_MODE=2 %s -verify
4*0a6a1f1dSLionel Sambuc 
5*0a6a1f1dSLionel Sambuc // expected-no-diagnostics
6*0a6a1f1dSLionel Sambuc 
7*0a6a1f1dSLionel Sambuc struct A {
8*0a6a1f1dSLionel Sambuc   A();
9*0a6a1f1dSLionel Sambuc   virtual void foo();
10*0a6a1f1dSLionel Sambuc };
11*0a6a1f1dSLionel Sambuc 
12*0a6a1f1dSLionel Sambuc // At /vd1, there is a vtordisp before A.
13*0a6a1f1dSLionel Sambuc struct B : virtual A {
14*0a6a1f1dSLionel Sambuc   B();
15*0a6a1f1dSLionel Sambuc   virtual void foo();
16*0a6a1f1dSLionel Sambuc   virtual void bar();
17*0a6a1f1dSLionel Sambuc };
18*0a6a1f1dSLionel Sambuc 
19*0a6a1f1dSLionel Sambuc // At /vd2, there is a vtordisp before B, but only because it has its own
20*0a6a1f1dSLionel Sambuc // vftable.
21*0a6a1f1dSLionel Sambuc struct C : virtual B {
22*0a6a1f1dSLionel Sambuc   C();
23*0a6a1f1dSLionel Sambuc };
24*0a6a1f1dSLionel Sambuc 
25*0a6a1f1dSLionel Sambuc // There are two vfptrs, two vbptrs, and some number of vtordisps.
26*0a6a1f1dSLionel Sambuc static_assert(sizeof(C) == 2 * 4 + 2 * 4 + 4 * VTORDISP_MODE, "size mismatch");
27