Thread overview
Array of associative array.
Oct 28, 2013
Wolftein
Oct 28, 2013
Ali Çehreli
Oct 29, 2013
Andrej Mitrovic
October 28, 2013
public static CompilerTable = [
     ////////////////////////////////////////////////////////////
     /// \brief DMD
     ////////////////////////////////////////////////////////////
     ["-c"               : "-c",
      "-debug"           : "-debug",
      "-g"               : "-g",
      "-gc"              : "-gc",
      "-I"               : "-I",
      "-inline"          : "-inline",
      "-L"               : "-L",
      "-lib"             : "-lib",
      "-noboundscheck"   : "-noboundscheck",
      "-O"               : "-O",
      "-o-"              : "-o-",
      "-odobjdir"        : "-odobjdir",
      "-offilename"      : "-offilename",
      "-profile"         : "-profile",
      "-release"         : "-release",
      "-unittest"        : "-unittest",
      "-w"               : "-w",
      "-wi"              : "-wi"],

     ////////////////////////////////////////////////////////////
     /// \brief LDC
     ////////////////////////////////////////////////////////////
     ["-c"               : "-c",
      "-debug"           : "-debug",
      "-g"               : "-g",
      "-gc"              : "-gc",
      "-I"               : "-I",
      "-inline"          : "-inline",
      "-L"               : "-L",
      "-lib"             : "-lib",
      "-noboundscheck"   : "-noboundscheck",
      "-O"               : "-O",
      "-o-"              : "-o-",
      "-odobjdir"        : "-odobjdir",
      "-offilename"      : "-offilename",
      "-profile"         : "-profile",
      "-release"         : "-release",
      "-unittest"        : "-unittest",
      "-w"               : "-w",
      "-wi"              : "-wi"],

     ////////////////////////////////////////////////////////////
     /// \brief GDC
     ////////////////////////////////////////////////////////////
     ["-c"               : "-c",
      "-debug"           : "-fdebug",
      "-g"               : "-g",
      "-gc"              : "-g",
      "-I"               : "-I",
      "-inline"          : "-finline-functions",
      "-L"               : "-Wl",
      "-lib"             : "",
      "-noboundscheck"   : "-noboundscheck",
      "-O"               : "-O3",
      "-o-"              : "-fsyntax-only",
      "-odobjdir"        : "-od",
      "-offilename"      : "-o",
      "-profile"         : "-profile",
      "-release"         : "-release",
      "-unittest"        : "-unittest",
      "-w"               : "-Wall",
      "-wi"              : "-Wextra"]
];

Error: variable org.ghrum.installer.option.CompilerTable cannot
infer type from initializer
October 28, 2013
On Monday, 28 October 2013 at 21:26:41 UTC, Auto cannot infer
type from initializer wrote:
> public static CompilerTable = [
>      ////////////////////////////////////////////////////////////
>      /// \brief DMD
>      ////////////////////////////////////////////////////////////
>      ["-c"               : "-c",
>       "-debug"           : "-debug",
>       "-g"               : "-g",
>       "-gc"              : "-gc",
>       "-I"               : "-I",
>       "-inline"          : "-inline",
>       "-L"               : "-L",
>       "-lib"             : "-lib",
>       "-noboundscheck"   : "-noboundscheck",
>       "-O"               : "-O",
>       "-o-"              : "-o-",
>       "-odobjdir"        : "-odobjdir",
>       "-offilename"      : "-offilename",
>       "-profile"         : "-profile",
>       "-release"         : "-release",
>       "-unittest"        : "-unittest",
>       "-w"               : "-w",
>       "-wi"              : "-wi"],
>
>      ////////////////////////////////////////////////////////////
>      /// \brief LDC
>      ////////////////////////////////////////////////////////////
>      ["-c"               : "-c",
>       "-debug"           : "-debug",
>       "-g"               : "-g",
>       "-gc"              : "-gc",
>       "-I"               : "-I",
>       "-inline"          : "-inline",
>       "-L"               : "-L",
>       "-lib"             : "-lib",
>       "-noboundscheck"   : "-noboundscheck",
>       "-O"               : "-O",
>       "-o-"              : "-o-",
>       "-odobjdir"        : "-odobjdir",
>       "-offilename"      : "-offilename",
>       "-profile"         : "-profile",
>       "-release"         : "-release",
>       "-unittest"        : "-unittest",
>       "-w"               : "-w",
>       "-wi"              : "-wi"],
>
>      ////////////////////////////////////////////////////////////
>      /// \brief GDC
>      ////////////////////////////////////////////////////////////
>      ["-c"               : "-c",
>       "-debug"           : "-fdebug",
>       "-g"               : "-g",
>       "-gc"              : "-g",
>       "-I"               : "-I",
>       "-inline"          : "-finline-functions",
>       "-L"               : "-Wl",
>       "-lib"             : "",
>       "-noboundscheck"   : "-noboundscheck",
>       "-O"               : "-O3",
>       "-o-"              : "-fsyntax-only",
>       "-odobjdir"        : "-od",
>       "-offilename"      : "-o",
>       "-profile"         : "-profile",
>       "-release"         : "-release",
>       "-unittest"        : "-unittest",
>       "-w"               : "-Wall",
>       "-wi"              : "-Wextra"]
> ];
>
> Error: variable org.ghrum.installer.option.CompilerTable cannot
> infer type from initializer

The declaration is public static auto CompilerTable = [ ... ]
October 28, 2013
On Monday, 28 October 2013 at 21:27:46 UTC, Auto cannot infer type from initializer wrote:
> On Monday, 28 October 2013 at 21:26:41 UTC, Auto cannot infer
> type from initializer wrote:
>> public static CompilerTable = [
>>     ////////////////////////////////////////////////////////////
>>     /// \brief DMD
>>     ////////////////////////////////////////////////////////////
>>     ["-c"               : "-c",
>>      "-debug"           : "-debug",
>>      "-g"               : "-g",
>>      "-gc"              : "-gc",
>>      "-I"               : "-I",
>>      "-inline"          : "-inline",
>>      "-L"               : "-L",
>>      "-lib"             : "-lib",
>>      "-noboundscheck"   : "-noboundscheck",
>>      "-O"               : "-O",
>>      "-o-"              : "-o-",
>>      "-odobjdir"        : "-odobjdir",
>>      "-offilename"      : "-offilename",
>>      "-profile"         : "-profile",
>>      "-release"         : "-release",
>>      "-unittest"        : "-unittest",
>>      "-w"               : "-w",
>>      "-wi"              : "-wi"],
>>
>>     ////////////////////////////////////////////////////////////
>>     /// \brief LDC
>>     ////////////////////////////////////////////////////////////
>>     ["-c"               : "-c",
>>      "-debug"           : "-debug",
>>      "-g"               : "-g",
>>      "-gc"              : "-gc",
>>      "-I"               : "-I",
>>      "-inline"          : "-inline",
>>      "-L"               : "-L",
>>      "-lib"             : "-lib",
>>      "-noboundscheck"   : "-noboundscheck",
>>      "-O"               : "-O",
>>      "-o-"              : "-o-",
>>      "-odobjdir"        : "-odobjdir",
>>      "-offilename"      : "-offilename",
>>      "-profile"         : "-profile",
>>      "-release"         : "-release",
>>      "-unittest"        : "-unittest",
>>      "-w"               : "-w",
>>      "-wi"              : "-wi"],
>>
>>     ////////////////////////////////////////////////////////////
>>     /// \brief GDC
>>     ////////////////////////////////////////////////////////////
>>     ["-c"               : "-c",
>>      "-debug"           : "-fdebug",
>>      "-g"               : "-g",
>>      "-gc"              : "-g",
>>      "-I"               : "-I",
>>      "-inline"          : "-finline-functions",
>>      "-L"               : "-Wl",
>>      "-lib"             : "",
>>      "-noboundscheck"   : "-noboundscheck",
>>      "-O"               : "-O3",
>>      "-o-"              : "-fsyntax-only",
>>      "-odobjdir"        : "-od",
>>      "-offilename"      : "-o",
>>      "-profile"         : "-profile",
>>      "-release"         : "-release",
>>      "-unittest"        : "-unittest",
>>      "-w"               : "-Wall",
>>      "-wi"              : "-Wextra"]
>> ];
>>
>> Error: variable org.ghrum.installer.option.CompilerTable cannot
>> infer type from initializer
>
> The declaration is public static auto CompilerTable = [ ... ]

Had to use string[string][] instead of auto.
October 28, 2013
On 10/28/2013 02:39 PM, Wolftein wrote:

>>> Error: variable org.ghrum.installer.option.CompilerTable cannot
>>> infer type from initializer
>>
>> The declaration is public static auto CompilerTable = [ ... ]
>
> Had to use string[string][] instead of auto.

Looks like a compiler bug to me. Reduced:

void foo(T)(T)
{
    pragma(msg, T.stringof);
}

void main()
{
    // Works and prints string[string][]
    pragma(msg, typeof([ [ "a" : "a"] ]).stringof);

    // Works and prints string[string][]
    foo([ [ "a" : "a"] ]);

    // However, this fails
    auto a = [ [ "a" : "a"] ];
}

Is there a reason why the last line cannot be compiled?

Ali

October 29, 2013
On 10/28/13, Ali Çehreli <acehreli@yahoo.com> wrote:
> Looks like a compiler bug to me. Reduced:
> Is there a reason why the last line cannot be compiled?

Could be one of these:

http://d.puremagic.com/issues/show_bug.cgi?id=9295 http://d.puremagic.com/issues/show_bug.cgi?id=9520

There's a bunch of these array literal bugs.