Thread overview
[dmd-beta] D2 beta 2.057
Dec 12, 2011
Walter Bright
Dec 12, 2011
David Simcha
Dec 12, 2011
Richard Webb
Dec 12, 2011
Walter Bright
Dec 12, 2011
Walter Bright
Dec 12, 2011
Richard Webb
Dec 12, 2011
Walter Bright
Dec 12, 2011
Walter Bright
Dec 13, 2011
Walter Bright
December 11, 2011
More of Kenji's fixes.

http://ftp.digitalmars.com/dmd2beta.zip
December 11, 2011
On 12/11/2011 9:59 PM, Walter Bright wrote:
> More of Kenji's fixes.
>
> http://ftp.digitalmars.com/dmd2beta.zip
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>
Thumbs up.  Looks like a terrific release!
December 12, 2011
On 12/12/2011 02:59, Walter Bright wrote:
> More of Kenji's fixes.
>
> http://ftp.digitalmars.com/dmd2beta.zip


I tried building Juno with the latest beta, and got a build failure related to ParameterTypeTuple and function type parameters.

Seems to be related to this: In 2.056, the code

//////////////////////////////////////////
import std.traits;

extern(Windows)
alias void function(void* hInternet, uint dwContext, uint
dwInternetStatus, void* lpvStatusInformation, uint
dwStatusInformationLength) INTERNET_STATUS_CALLBACK;

extern(Windows)
alias void function(void* hInternet, INTERNET_STATUS_CALLBACK
lpfnStatusCallback) InternetSetStatusCallbackType;

struct DllImport(TFunction) {

   static ReturnType!(TFunction) opCall(ParameterTypeTuple!(TFunction)
args) {
       pragma (msg, "TFunction1: " ~ typeof(args[1]).stringof);
   }
}

extern(Windows)
alias DllImport!(InternetSetStatusCallbackType) InternetSetStatusCallback;


void test()
{
     extern(Windows)
     static void foo(void* hInternet, uint dwContext, uint
dwInternetStatus, void* lpvStatusInformation, uint
dwStatusInformationLength)
     {

     }

     InternetSetStatusCallback(null, &foo);
}
//////////////////////////////////////////

compiles ok and prints

TFunction1: extern (Windows) void function(void* hInternet, uint dwContext, uint dwInternetStatus, void* lpvStatusInformation, uint dwStatusInformationLength)

whereas with the latest beta, it fails to build with a parameter mismatch to opCall error and prints

TFunction1: void function(void* hInternet, uint dwContext, uint dwInternetStatus, void* lpvStatusInformation, uint dwStatusInformationLength)


so it seems like the 'extern (Windows)' has been lost.

Is this intentional?
December 12, 2011
So far, this reduces to:

template ParameterTypeTuple(func)
{
     static if (is(func Fptr : Fptr*) && is(Fptr P == function))
         alias P ParameterTypeTuple;
     else
         static assert(0, "argument has no parameters");
}

extern(Windows) alias void function() fpw_t;

extern(Windows) alias void function(fpw_t fp) cb_t;

struct DllImport(TFunction) {

//extern(Windows)
   static void bar(ParameterTypeTuple!(cb_t) args) {
       pragma (msg, "TFunction1: " ~ typeof(args[0]).stringof);
   }
}

extern(Windows)
alias DllImport!(cb_t) InternetSetStatusCallback;


void test()
{
     extern(Windows) static void foo() { }

     InternetSetStatusCallback.bar(&foo);
}


On 12/12/2011 2:16 AM, Richard Webb wrote:
>
> I tried building Juno with the latest beta, and got a build failure related to ParameterTypeTuple and function type parameters.
>
> Seems to be related to this: In 2.056, the code
>
December 12, 2011
It worked on 2.056, and fails now. Definitely a bug.

Anyone want to try that divide-and-conquer git thing?
---------------------------
template ParameterTypeTuple(func)
{
     static if (is(func Fptr : Fptr*) && is(Fptr P == function)
         alias P ParameterTypeTuple;
     else
         static assert(0, "argument has no parameters");
}

extern(Windows) alias void function() fpw_t;

alias void function(fpw_t fp) cb_t;

//extern(Windows)
void bar(ParameterTypeTuple!(cb_t) args) {
       pragma (msg, "TFunction1: " ~ typeof(args[0]).stringof);
}

extern(Windows) void foo() { }

void test()
{
     bar(&foo);
}
----------------------------------------

December 12, 2011
On 12/12/2011 20:07, Walter Bright wrote:
> It worked on 2.056, and fails now. Definitely a bug.
>
> Anyone want to try that divide-and-conquer git thing?
> ---------------------------


I think it's related to https://github.com/D-Programming-Language/dmd/commit/aa6bf96f8144300bdf965b321eb459c9ca3dc482

(reverting that change seems to get Juno building at any rate).
December 12, 2011

On 12/12/2011 12:44 PM, Richard Webb wrote:
> On 12/12/2011 20:07, Walter Bright wrote:
>> It worked on 2.056, and fails now. Definitely a bug.
>>
>> Anyone want to try that divide-and-conquer git thing?
>> ---------------------------
>
>
> I think it's related to https://github.com/D-Programming-Language/dmd/commit/aa6bf96f8144300bdf965b321eb459c9ca3dc482
>
>
> (reverting that change seems to get Juno building at any rate).
>

Thanks for finding this, I'll check it out.
December 12, 2011

On 12/12/2011 12:44 PM, Richard Webb wrote:
>
> I think it's related to https://github.com/D-Programming-Language/dmd/commit/aa6bf96f8144300bdf965b321eb459c9ca3dc482
>
>
> (reverting that change seems to get Juno building at any rate).
>

Yep, that's it. I'll see about a fix.
December 12, 2011
Testing fix now.

On 12/12/2011 2:30 PM, Walter Bright wrote:
>
>
> On 12/12/2011 12:44 PM, Richard Webb wrote:
>>
>> I think it's related to https://github.com/D-Programming-Language/dmd/commit/aa6bf96f8144300bdf965b321eb459c9ca3dc482
>>
>>
>> (reverting that change seems to get Juno building at any rate).
>>
>
> Yep, that's it. I'll see about a fix.
>