diff --git a/tests/src/tests/tests.instruction.cpp b/tests/src/tests/tests.instruction.cpp index 3fcb52d..65a7553 100644 --- a/tests/src/tests/tests.instruction.cpp +++ b/tests/src/tests/tests.instruction.cpp @@ -78,32 +78,4 @@ namespace zasm::tests } } - TEST(InstructionTests, TestVisit) - { - auto ins = zasm::Instruction() // - .setMnemonic(x86::Mnemonic::Mov) // - .addOperand(x86::rax) // - .addOperand(x86::rdx); // - - // Test if the conversion from base to upper works. - auto testVisit = [](InstructionBase& base) { - return base.visit([](auto&& real) { - // - real.setMnemonic(x86::Mnemonic::Sub); - return real.getOperandCount(); - }); - }; - - auto detail = ins.getDetail(MachineMode::AMD64); - detail->addOperand(x86::rdx); - - auto opCount1 = testVisit(ins); - ASSERT_EQ(ins.getMnemonic(), x86::Mnemonic::Sub); - ASSERT_EQ(opCount1, 2); - - auto opCount2 = testVisit(*detail); - ASSERT_EQ(detail->getMnemonic(), x86::Mnemonic::Sub); - ASSERT_EQ(opCount2, 3); - } - } // namespace zasm::tests diff --git a/zasm/include/zasm/base/instruction.hpp b/zasm/include/zasm/base/instruction.hpp index 5d80b8e..b117242 100644 --- a/zasm/include/zasm/base/instruction.hpp +++ b/zasm/include/zasm/base/instruction.hpp @@ -86,22 +86,6 @@ namespace zasm return *this; } - template auto visit(TPred&& fn) const - { - if (_type == Type::Detail) - return fn(static_cast(*this)); - else - return fn(static_cast(*this)); - } - - template auto visit(TPred&& fn) - { - if (_type == Type::Detail) - return fn(static_cast(*this)); - else - return fn(static_cast(*this)); - } - /// /// Casts this object to T. T must be a type that inherits InstructionBase and has kInstrType. /// Casting to the wrong type is UB.