summaryrefslogtreecommitdiffstats
path: root/test/PCH/cxx1y-deduced-return-type.cpp
blob: a61dda21e7f9ab2231de0270d459be27aee1216d (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
25
26
27
28
29
30
31
32
33
34
// No PCH:
// RUN: %clang_cc1 -pedantic -std=c++1y -include %s -include %s -verify %s
//
// With chained PCH:
// RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch %s -o %t.a
// RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t.a -emit-pch %s -o %t.b
// RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t.b -verify %s

// expected-no-diagnostics

#if !defined(HEADER1)
#define HEADER1

auto &f(int &);

template<typename T> decltype(auto) g(T &t) {
  return f(t);
}

#elif !defined(HEADER2)
#define HEADER2

// Ensure that this provides an update record for the type of HEADER1's 'f',
// so that HEADER1's 'g' can successfully call it.
auto &f(int &n) {
  return n;
}

#else

int n;
int &k = g(n);

#endif