brintos

brintos / llvm-project-archived public Read only

0
0
Text · 936 B · d340b3b Raw
31 lines · cpp
1// Test this without pch.2// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -DBODY %s -o - | FileCheck %s3 4// Test with pch.5// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-pch -o %t %s6// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -include-pch %t -DBODY %s -o - | FileCheck %s7 8// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-pch -fpch-instantiate-templates -o %t %s9// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -include-pch %t -DBODY %s -o - | FileCheck %s10 11// expected-no-diagnostics12 13#ifndef HEADER_H14#define HEADER_H15struct A {16  void foo() { bar<0>(); } // This will trigger implicit instantiation of bar<0>() in the PCH.17  template <int N>18  void bar();19};20#endif21 22#ifdef BODY23// But the definition is only in the source, so the instantiation must be delayed until the TU.24template <int N>25void A::bar() {}26 27void test(A *a) { a->foo(); }28#endif29 30// CHECK: define linkonce_odr void @_ZN1A3barILi0EEEvv31