See More

/*******************************************************************\ Module: C++ Language Type Checking Author: Daniel Kroening, [email protected] \*******************************************************************/ /// \file /// C++ Language Type Checking #include "cpp_typecheck_fargs.h" #include #include "cpp_typecheck.h" bool cpp_typecheck_fargst::has_class_type() const { for(const auto &op : operands) { if(op.type().id() == ID_struct) return true; } return false; } void cpp_typecheck_fargst::build( const side_effect_expr_function_callt &function_call) { in_use=true; operands = function_call.arguments(); } bool cpp_typecheck_fargst::match( const code_typet &code_type, unsigned &distance, cpp_typecheckt &cpp_typecheck) const { distance=0; exprt::operandst ops=operands; const code_typet::parameterst &parameters=code_type.parameters(); if(parameters.size()>ops.size()) { // Check for default values. ops.reserve(parameters.size()); for(std::size_t i=ops.size(); i " << cpp_typecheck.to_string(parameter.type()) << '\n'; #endif // can we do the standard conversion sequence? if(cpp_typecheck.implicit_conversion_sequence( operand, type, new_expr, rank)) { // ok distance+=rank; #if 0 std::cout << "OK " << rank << '\n'; #endif } else if( operand.id() == ID_initializer_list && cpp_typecheck.cpp_is_pod(type) && operand.operands().size() == 1 && cpp_typecheck.implicit_conversion_sequence( to_unary_expr(operand).op(), type, new_expr, rank)) { distance += rank; } else { #if 0 std::cout << "NOT OK\n"; #endif return false; // no conversion possible } ++it; } // we may not have used all operands for( ; it!=ops.end(); ++it) // Ellipsis is the 'worst' of the conversion sequences distance+=1000; return true; }