figure out where a particular template function is located

Steven Schveighoffer schveiguy at gmail.com
Wed Jun 24 21:05:12 UTC 2020


On 6/24/20 4:38 PM, Adam D. Ruppe wrote:
> On Wednesday, 24 June 2020 at 20:28:24 UTC, Steven Schveighoffer wrote:
>> Is there a way to figure this out from the call?
> 
> The .mangleof the instance might help track it down since it should give 
> you the module name as part of that mangle. Then go in there and start 
> breaking things (or use the __FILE__, __LINE__ default args) to narrow 
> it down.
> 
> not a great answer but sould at least get you started.

mangleof just gives me the return type mangle:

pragma(msg, foo!int("hi").mangleof); => v (for void)

I have a hard time believing that there's no way to do this! Is there 
some kind of is-expression that could do this?

Even if I use -vcg-ast it's not going to give me the exact instantiation 
at the call site (it just shows, e.g. foo("hi"))

I can probably disassemble, and use the mangled name to get back to the 
real name. But at this point, I'm not going to put in that effort. I 
just hoped that there was a way to do this in code.

-Steve


More information about the Digitalmars-d-learn mailing list