Cannot check function address

frame frame86 at live.com
Tue May 24 22:10:21 UTC 2022


On Tuesday, 24 May 2022 at 19:09:52 UTC, Steven Schveighoffer 
wrote:

> This doesn't seem valid for module-level code, assert is an 
> instruction, not a declaration.
> ...
> Try `std.traits.fullyQualifiedName!fun` to see where it's 
> coming from.
>
> expected 5 got 0 suggests it is finding some other fun, as 
> a.fun only takes a single parameter.

Of course this `assert()` is actually inside `static this()` and 
there is only one declaration. I just want to show that the used 
symbol and call is the same.

Also this is **working** code. I just put the `assert()` there to 
ensure the function isn't called by a race condition before it 
was loaded (module constructors often have cyclic dependency, so 
I cannot put this in a more clean way).

Those asserts() are set in:

module A: module constructor
module B: some function

To also anwser to Adam: no, this symbol is unique. The first line 
of the error says:

```
Error: function `a.fun(string param)` is not callable using 
argument types `()`.
```

**Note that I have changed the actual module name and signature, 
it has orginal 5 arguments and very long names.**

The point is, it shouldn't be called in this line anyway?


More information about the Digitalmars-d-learn mailing list