Thread overview
Alias parameter + AA + external module
Feb 08, 2013
Dicebot
Feb 08, 2013
bearophile
Feb 08, 2013
Dicebot
Feb 08, 2013
monarch_dodra
Feb 08, 2013
Dicebot
Feb 08, 2013
monarch_dodra
Feb 08, 2013
Dicebot
February 08, 2013
== mod.d ==
void func!(alias arr)()
{
    arr["key"] = 43;
}

== test.d ==
import mod;

void main()
{
    auto arr = [ "key" : 42 ];
    func!(arr)();
}

== shell ==
$ rdmd test.d
.../test.o: In function `_D4test4mainFZv36__T4funcS24_D4test4mainFZv3arrHAyaiZ4funcMFZv':
test.d:(.text._D4test4mainFZv36__T4funcS24_D4test4mainFZv3arrHAyaiZ4funcMFZv+0x3e): undefined reference to `_D3mod7__arrayZ'
collect2: ld returned 1 exit status
--- errorlevel 1

This works if I move func to main module. Also works when passing integer variable as an alias param. Also works on x32 linux, but fails on x64.

What should I blame and search in bugzilla for? :) My code has used this idiom extensively and encountering this while checking x64 compatibility was an unpleasant surprise :(
February 08, 2013
Dicebot:

> void func!(alias arr)()
> {
>     arr["key"] = 43;
> }

I think you have to remove that exclamation mark.

Bye,
bearophile
February 08, 2013
On Friday, 8 February 2013 at 15:20:53 UTC, bearophile wrote:
> Dicebot:
>
>> void func!(alias arr)()
>> {
>>    arr["key"] = 43;
>> }
>
> I think you have to remove that exclamation mark.
>
> Bye,
> bearophile

Typo, irrelevant to subject.
February 08, 2013
On Friday, 8 February 2013 at 15:22:09 UTC, Dicebot wrote:
> On Friday, 8 February 2013 at 15:20:53 UTC, bearophile wrote:
>> Dicebot:
>>
>>> void func!(alias arr)()
>>> {
>>>   arr["key"] = 43;
>>> }
>>
>> I think you have to remove that exclamation mark.
>>
>> Bye,
>> bearophile
>
> Typo, irrelevant to subject.

Wait, this is giving me a compile error. You are getting a link error. What's going on?
February 08, 2013
On Friday, 8 February 2013 at 15:39:05 UTC, monarch_dodra wrote:
> Wait, this is giving me a compile error. You are getting a link error. What's going on?

What compile error do you get? After removing exclamation mark from func declaration it works as described for me.
February 08, 2013
On Friday, 8 February 2013 at 16:11:48 UTC, Dicebot wrote:
> On Friday, 8 February 2013 at 15:39:05 UTC, monarch_dodra wrote:
>> Wait, this is giving me a compile error. You are getting a link error. What's going on?
>
> What compile error do you get? After removing exclamation mark from func declaration it works as described for me.

I miss-understood you. I thought the ! was the source of the problem.

I'm indeed getting the intended link error without it.
February 08, 2013
Ok, can't find in bugzilla anything similar, have filed new one: http://d.puremagic.com/issues/show_bug.cgi?id=9486