Contents

Overview

The motivation behind this feature is to allow a shorthand notation to create a template base on another template, and optionally have zero or more template arguments specified. The keyword using is introduced to allow this behavior.

In the above example, fib is a template alias of vector<int,My_alloc<int>>, therefore both fib and verbose have identical types.

The using keywords acts like similar to typedef, in that both keywords introduces a typedef-name.

Proposed change to DWARF

New DWARF tag:

DW_TAG_template_alias

0x42

template alias

Allowable attributes: (modeled after DW_TAG_typedef)

DECL

DW_AT_abstract_origin

DW_AT_accessibility

DW_AT_allocated

DW_AT_assocated

DW_AT_data_location

DW_AT_declaration

DW_AT_description

DW_AT_name

DW_AT_sibling

DW_AT_start_scope

DW_AT_type

DW_AT_visibility

5.17: Template Alias Entries

Any arbitrary type named via template alias is represented by a debugging information entry with the tag DW_TAG_template_alias. The template alias entry has a DW_AT_name attribute whose value is a null-terminated string containing the name of the template alias as it appears in the source program. The template alias entry also contains a DW_AT_type attribute. The template alias entry will have the following child entries:

Each formal parameterized type declaration appearing in the template alias declaration is represented by a debugging information entry with the tag DW_TAG_template_type_parameter. Each such entry may have a DW_AT_name attribute, whose value is a null-terminated string containing the name of the formal type parameter as it appears in the source program. The template type parameter entry also has a DW_AT_type attribute describing the actual type by which the formal is replaced for this instantiation.

Each formal parameterized value declaration appearing in the template alias declaration is represented by a debugging information entry with the tag DW_TAG_template_value_parameter. Each such entry may have a DW_AT_name attribute, whose value is a null-terminated string containing the name of the formal value parameter as it appears in the source program. The template value parameter entry also has a DW_AT_type attribute describing the type of the parameterized value. Finally, the template value parameter entry has a DW_AT_const_value attribute, whose value is the actual constant value of the value parameter for this instantiation as represented on the target architecture.

Appendix

D.10.1 Template Aliases example

First, no aliases at all. This is just plain old ordinary template instance DWARF: