brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 0accd54 Raw
51 lines · cpp
1// Test default argument instantiation in chained PCH.2 3// Without PCH4// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -include %s -include %s %s5 6// With PCH7// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -chain-include %s -chain-include %s8 9// With modules10// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -fmodules %s -chain-include %s -chain-include %s11 12// expected-no-diagnostics13 14#ifndef HEADER115#define HEADER116//===----------------------------------------------------------------------===//17// Primary header.18 19namespace rdar23810407 {20  template<typename T> int f(T t) {21    extern T rdar23810407_variable;22    return 0;23  }24  template<typename T> int g(int a = f([] {}));25}26 27//===----------------------------------------------------------------------===//28#elif not defined(HEADER2)29#define HEADER230#if !defined(HEADER1)31#error Header inclusion order messed up32#endif33 34//===----------------------------------------------------------------------===//35// Dependent header.36 37inline void instantiate_once() {38  rdar23810407::g<int>();39}40 41//===----------------------------------------------------------------------===//42#else43//===----------------------------------------------------------------------===//44 45void test() {46  rdar23810407::g<int>();47}48 49//===----------------------------------------------------------------------===//50#endif51