xref: /llvm-project/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py (revision 46e848a23b212204b01abdc898a53b553d9a57c0)
1import lldb
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import *
4from lldbsuite.test import lldbutil
5
6
7class TestCase(TestBase):
8    @no_debug_info_test
9    def test(self):
10        self.build()
11        self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
12
13        # The offset of f2 should be 8 because of `alignas(8)`.
14        self.expect_expr("(intptr_t)&d3g.f2 - (intptr_t)&d3g", result_value="8")
15
16        # Verify specified class alignments.
17        self.expect_expr("alignof(B2)", result_value="8")
18        self.expect_expr("alignof(EmptyClassAlign8)", result_value="8")
19        self.expect_expr("alignof(Derived)", result_value="8")
20