p4-1y.cpp revision f45c2992a3aac7591310cd824b7c7319afd432fc
1// RUN: %clang_cc1 -fsyntax-only -std=c++1y %s -verify 2 3int a; 4int &b = [] (int &r) -> decltype(auto) { return r; } (a); 5int &c = [] (int &r) -> decltype(auto) { return (r); } (a); 6int &d = [] (int &r) -> auto & { return r; } (a); 7int &e = [] (int &r) -> auto { return r; } (a); // expected-error {{cannot bind to a temporary}} 8int &f = [] (int r) -> decltype(auto) { return r; } (a); // expected-error {{cannot bind to a temporary}} 9int &g = [] (int r) -> decltype(auto) { return (r); } (a); // expected-warning {{reference to stack}} 10