]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/PCH/cxx1y-decltype-auto.cpp
Vendor import of clang tags/RELEASE_33/final r183502 (effectively, 3.3
[FreeBSD/FreeBSD.git] / test / PCH / cxx1y-decltype-auto.cpp
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
3
4 #ifndef HEADER_INCLUDED
5
6 #define HEADER_INCLUDED
7
8 template<typename T> void f(T t) {
9   auto a = t.x;
10   decltype(auto) b = t.x;
11   auto c = (t.x);
12   decltype(auto) d = (t.x);
13 }
14
15 #else
16
17 struct Z {
18   int x : 5; // expected-note {{bit-field}}
19 };
20
21 // expected-error@12 {{non-const reference cannot bind to bit-field 'x'}}
22 template void f(Z); // expected-note {{in instantiation of}}
23
24 #endif