xref: /llvm-project/lldb/test/API/lang/cpp/standards/cpp20/TestCPP20Standard.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1import lldb
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import *
4from lldbsuite.test import lldbutil
5
6
7class TestCPP20Standard(TestBase):
8    @add_test_categories(["libc++"])
9    @skipIf(compiler="clang", compiler_version=["<", "11.0"])
10    def test_cpp20(self):
11        """
12        Tests that we can evaluate an expression in C++20 mode
13        """
14        self.build()
15        lldbutil.run_to_source_breakpoint(self, "Foo{}", lldb.SBFileSpec("main.cpp"))
16
17        self.expect(
18            "expr -l c++11 -- Foo{} <=> Foo{}",
19            error=True,
20            substrs=[
21                "'<=>' is a single token in C++20; add a space to avoid a change in behavior"
22            ],
23        )
24
25        self.expect("expr -l c++20 -- Foo{} <=> Foo{}", substrs=["(bool) $0 = true"])
26