aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/compilable/b6400.d
blob: 2c71107e9131174314ef7de72e79a7dfa3160a5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* TEST_OUTPUT:
---
Foo
Bar
---
*/
class Foo
{
    void opDispatch(string name)() { pragma(msg, "Foo"); }
}
class Bar
{
    void opDispatch(string name)() { pragma(msg, "Bar"); }
}
class Baz
{
}

void main()
{
    auto foo = new Foo;
    auto bar = new Bar;
    auto baz = new Baz;

    with (foo)
    {
        f0();
        with (bar)
        {
            f1();
        }
        with (baz)
        {
            static assert(!__traits(compiles, f2()));
        }
    }
}