Home | History | Annotate | Download | only in PCH
      1 // No PCH:
      2 // RUN: %clang_cc1 -pedantic -std=c++1y -include %s -include %s -verify %s
      3 //
      4 // With chained PCH:
      5 // RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch %s -o %t.a
      6 // RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t.a -emit-pch %s -o %t.b
      7 // RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t.b -verify %s
      8 
      9 // expected-no-diagnostics
     10 
     11 #if !defined(HEADER1)
     12 #define HEADER1
     13 
     14 auto &f(int &);
     15 
     16 template<typename T> decltype(auto) g(T &t) {
     17   return f(t);
     18 }
     19 
     20 #elif !defined(HEADER2)
     21 #define HEADER2
     22 
     23 // Ensure that this provides an update record for the type of HEADER1's 'f',
     24 // so that HEADER1's 'g' can successfully call it.
     25 auto &f(int &n) {
     26   return n;
     27 }
     28 
     29 #else
     30 
     31 int n;
     32 int &k = g(n);
     33 
     34 #endif
     35