Rebase.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / lambda / lambda-deduce-ext-neg.C
blob88970a93309031927a6964b2b8099c7df2b9bd19
1 // Testcase for DR 975.
3 // { dg-do compile { target c++11 } }
5 bool b;
6 struct A { int fn1(); const int& fn2(); };
7 struct B { int fn1(); long fn2(); };
9 template <class T> int f (T t) {
10   return [](T t){
11     if (b)
12       return t.fn1();
13     else
14       return t.fn2();           // { dg-error "inconsistent types" }
15   }(t);
18 int main()
20   f(A());                       // { dg-bogus "" } int and const int& are compatible
21   f(B());                       // { dg-message "from here" } int and long are not