xref: /llvm-project/lldb/test/API/lang/cpp/standards/cpp20/TestCPP20Standard.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
189cd0e8cSMichael Buchimport lldb
289cd0e8cSMichael Buchfrom lldbsuite.test.decorators import *
389cd0e8cSMichael Buchfrom lldbsuite.test.lldbtest import *
489cd0e8cSMichael Buchfrom lldbsuite.test import lldbutil
589cd0e8cSMichael Buch
6*2238dcc3SJonas Devlieghere
789cd0e8cSMichael Buchclass TestCPP20Standard(TestBase):
852882de0SMichael Buch    @add_test_categories(["libc++"])
9*2238dcc3SJonas Devlieghere    @skipIf(compiler="clang", compiler_version=["<", "11.0"])
1089cd0e8cSMichael Buch    def test_cpp20(self):
1189cd0e8cSMichael Buch        """
1289cd0e8cSMichael Buch        Tests that we can evaluate an expression in C++20 mode
1389cd0e8cSMichael Buch        """
1489cd0e8cSMichael Buch        self.build()
1589cd0e8cSMichael Buch        lldbutil.run_to_source_breakpoint(self, "Foo{}", lldb.SBFileSpec("main.cpp"))
1689cd0e8cSMichael Buch
17*2238dcc3SJonas Devlieghere        self.expect(
18*2238dcc3SJonas Devlieghere            "expr -l c++11 -- Foo{} <=> Foo{}",
19*2238dcc3SJonas Devlieghere            error=True,
20*2238dcc3SJonas Devlieghere            substrs=[
21*2238dcc3SJonas Devlieghere                "'<=>' is a single token in C++20; add a space to avoid a change in behavior"
22*2238dcc3SJonas Devlieghere            ],
23*2238dcc3SJonas Devlieghere        )
2489cd0e8cSMichael Buch
2589cd0e8cSMichael Buch        self.expect("expr -l c++20 -- Foo{} <=> Foo{}", substrs=["(bool) $0 = true"])
26