[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / PCH / cxx1y-decltype-auto.cpp
blob8a85283cac75316f0c532f64444ef642d6535cb5
1 // RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch %s -o %t
2 // RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t -verify %s
4 // RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch -fpch-instantiate-templates %s -o %t
5 // RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t -verify %s
7 #ifndef HEADER_INCLUDED
9 #define HEADER_INCLUDED
11 template<typename T> void f(T t) {
12 auto a = t.x;
13 decltype(auto) b = t.x;
14 auto c = (t.x);
15 decltype(auto) d = (t.x);
18 #else
20 struct Z {
21 int x : 5; // expected-note {{bit-field}}
24 // expected-error@15 {{non-const reference cannot bind to bit-field 'x'}}
25 template void f(Z); // expected-note {{in instantiation of}}
27 #endif