d: Merge upstream dmd 568496d5b, druntime 178c44ff, phobos 574bf883b.
[official-gcc.git] / gcc / testsuite / gdc.test / compilable / test19203.d
blob206d662b431e8ba6812f863dcf5a8a1a1671610e
1 //https://issues.dlang.org/show_bug.cgi?id=19203
2 struct BoolWithErr {
3 bool b;
4 string error;
5 alias b this;
8 struct Foo {
9 int popBack() { return 0; }
12 struct Bar {}
14 template hasPopBack(T) {
15 static if (!is(typeof(T.init.popBack)))
16 enum hasPopBack = BoolWithErr(false, T.stringof~" does not have popBack");
17 else
18 enum hasPopBack = BoolWithErr(true,"");
21 void test()
23 static assert( hasPopBack!Foo);
24 static assert(!hasPopBack!Bar);
25 static assert( hasPopBack!Foo && !hasPopBack!Bar);