Need DMD AST expertise

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 20 11:59:09 PDT 2016


On 2016-06-20 14:33, Guillaume Chatelet wrote:

> Problem 2:
> ----------
> Template arguments that are of basic types are mangled in a special way
> which requires to understand which 'int' is which.
>
>> extern(C++) A foo(A, B)(B, A, B);
>> static assert(foo!(int,int).mangleof == "_Z3fooIiiET_T0_S0_S1_");
>
> In the example above the first 'int' is not the same as the second one,
> it's a distinct substitution.
>
> Question:
> ---------
> - How can I know which is which since from the AST perspective, the
> FunDeclaration's Parameters are just TypeBasic 'int'?
>
> ------------------------------------------------------------

Not sure I understand the question. Are you saying that the two integers 
are mangled differently because there are two template parameters? I'm 
guessing you need to look at the template declaration to get more 
information about the template parameters.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list