ObjectList<Type> Type::get_specializations() const
    {
        ObjectList<Type> result;

        int n = template_type_get_num_specializations(_type_info);

        for (int i = 0; i < n; i++)
        {
            result.append(template_type_get_specialization_num(_type_info, i));
        }

        return result;
    }
Example #2
0
type_t* solve_class_template(decl_context_t decl_context,
        type_t* template_type,
        type_t* specialized_type,
        deduction_set_t** unification_set,
        const char *filename,
        int line)
{
    template_argument_list_t* specialized
        = template_specialized_type_get_template_arguments(
                get_actual_class_type(specialized_type));

    int i;
    int num_specializations = template_type_get_num_specializations(template_type);

    type_t** matching_set = NULL;
    int num_matching_set = 0;

    deduction_set_t **deduction_results = NULL;
    int num_deductions = 0;

    for (i = 0; i < num_specializations; i++)
    {
        type_t* current_specialized_type = 
            template_type_get_specialization_num(template_type, i);

        DEBUG_CODE()
        {
            scope_entry_t* entry = named_type_get_symbol(current_specialized_type);
            fprintf(stderr, "SOLVETEMPLATE: Checking with specialization defined in '%s:%d'\n",
                    entry->file, entry->line);
        }

        // We do not want these for instantiation purposes
        if (class_type_is_incomplete_independent(
                    get_actual_class_type(current_specialized_type))
                || class_type_is_incomplete_dependent(
                    get_actual_class_type(current_specialized_type)))
        {
            DEBUG_CODE()
            {
                scope_entry_t* entry = named_type_get_symbol(current_specialized_type);
                fprintf(stderr, "SOLVETEMPLATE: Discarding '%s:%d' since it is incomplete\n",
                        entry->file, entry->line);
            }
            continue;
        }
Example #3
0
type_t* solve_class_template(type_t* template_type,
        type_t* specialized_type,
        template_parameter_list_t** deduced_template_arguments,
        const locus_t* locus)
{
    template_parameter_list_t* specialized
        = template_specialized_type_get_template_arguments(
                get_actual_class_type(specialized_type));

    int i;
    int num_specializations = template_type_get_num_specializations(template_type);

    type_t** matching_set = NULL;
    int num_matching_set = 0;

    template_parameter_list_t **deduction_results = NULL;
    int num_deductions = 0;

    for (i = 0; i < num_specializations; i++)
    {
        type_t* current_specialized_type = 
            template_type_get_specialization_num(template_type, i);

        DEBUG_CODE()
        {
            scope_entry_t* entry = named_type_get_symbol(current_specialized_type);
            fprintf(stderr, "SOLVETEMPLATE: Checking with specialization defined in '%s'\n",
                    locus_to_str(entry->locus));
        }

        // We do not want these for instantiation purposes
        if (!named_type_get_symbol(current_specialized_type)->entity_specs.is_instantiable)
        {
            DEBUG_CODE()
            {
                scope_entry_t* entry = named_type_get_symbol(current_specialized_type);
                fprintf(stderr, "SOLVETEMPLATE: Discarding '%s' (%s) since it has been created by the typesystem\n",
                        print_type_str(current_specialized_type, entry->decl_context),
                        locus_to_str(entry->locus));
            }
            continue;
        }