minix/external/bsd/llvm/dist/clang/test/PCH/cxx1y-deduced-return-type.cpp
Lionel Sambuc f4a2713ac8 Importing netbsd clang -- pristine
Change-Id: Ia40e9ffdf29b5dab2f122f673ff6802a58bc690f
2014-07-28 17:05:57 +02:00

34 lines
707 B
C++

// 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