I am using the Economic Modeling containers library, and because it uses std.experimental.allocator, it can't be used with LDC through dub. I have coded in such a way with static if's that LDC will still compile without it, but dub will try to compile it anyway because it's in the dependencies JSON dictionary.

So, I changed my configurations to the following, which somewhat works:

    "configurations": [
        {
            "name": "unittest",
            "mainSourceFile": "bench.d",
            "targetType": "executable",
            "dependencies": {
                "containers": "~>0.2.2"
            },
            "platforms": ["dmd"]
        },
        {
            "name": "unittest",
            "mainSourceFile": "bench.d",
            "targetType": "executable",
            "platforms": ["ldc2", "ldmd2"]
        },
        {
            "name": "library",
            "targetType": "library",
            "dependencies": {
                "containers": "~>0.2.2"
            },
            "platforms": ["dmd"]
        },
        {
            "name": "library",
            "targetType": "library",
            "platforms": ["ldc2", "ldmd2"]
        }
    ]

I can do dub --compiler=ldc2, but dub test --compiler=ldc2 results in

Could not resolve configuration for package containers