[Issue 20488] AA.length in multiple modules causes opDispatch failure
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 8 13:53:49 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20488
Simen Kjaeraas <simen.kjaras at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |simen.kjaras at gmail.com
Summary|Strange opDispatch error |AA.length in multiple
|with multiple module |modules causes opDispatch
|compilation and the use of |failure
|hashmaps |
--- Comment #1 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
Further reduced:
foo.d:
///////////////////////////
struct Foo {
bool[int] aa;
void fun() {
int i = aa.length;
}
}
///////////////////////////
bar.d:
///////////////////////////
struct Bar {
int[int] aa;
void fun() {
this.f(aa.length);
}
void opDispatch (string s, Args...) (Args args) {
}
}
///////////////////////////
Compile with 'dmd foo bar', and you get
bar.d(4): Error: no property f for type bar.Bar
If the two AA types are identical it compiles.
Adding 'int j = (int[int]).init.length;' to S1.fun() does make it compile, but
only if it's before the 'int i = ...' line (wat).
--
More information about the Digitalmars-d-bugs
mailing list