Code behaves incorrectly if it is compiled in std.functional

Meta via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 4 18:40:30 PDT 2015


This is so completely bizarre that I thought I was going crazy at 
first, but the same behaviour is exhibited whether I'm using my 
own copy of std.functional or a copy cloned straight from phobos 
master. The following code snippet exhibits different behaviour 
when it is put in a standalone file than when it is in 
std.functional:

unittest
{
     struct Foo2
     {
         int fun(int n) pure nothrow @safe @nogc
         {
             return n;
         }
     }

     import std.traits;
     pragma(msg, ParameterTypeTuple!(typeof(Foo2.fun)));
}

If I put the following snippet in test.d and run `dmd -unittest 
-main test.d`, it prints `(int)`.

HOWEVER, if I append the snippet to the end of std.functional and 
run
`dmd -unittest -main std\functional.d`, it prints `(auto int)` 
instead.

Can anyone else duplicate this bug at the very least? What in the 
world could be causing this?


More information about the Digitalmars-d mailing list