summaryrefslogtreecommitdiffstats
path: root/test/PCH/cxx1y-decltype-auto.cpp
blob: a1c9339cb669bfa78370c4bd4b2f90aafb05f3da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch %s -o %t
// RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t -verify %s

#ifndef HEADER_INCLUDED

#define HEADER_INCLUDED

template<typename T> void f(T t) {
  auto a = t.x;
  decltype(auto) b = t.x;
  auto c = (t.x);
  decltype(auto) d = (t.x);
}

#else

struct Z {
  int x : 5; // expected-note {{bit-field}}
};

// expected-error@12 {{non-const reference cannot bind to bit-field 'x'}}
template void f(Z); // expected-note {{in instantiation of}}

#endif