xref: /llvm-project/clang/test/CodeGenCXX/constexpr-late-instantiation.cpp (revision c5de4dd1eab00df76c1a68c5f397304ceacb71f2)
1 // Make sure foo is instantiated and we don't get a link error
2 // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o- | FileCheck %s
3 
4 template <typename T>
5 constexpr T foo(T a);
6 
7 // CHECK-LABEL: define {{.*}} @main
main()8 int main() {
9   // CHECK: call {{.*}} @_Z3fooIiET_S0_
10   int k = foo<int>(5);
11 }
12 // CHECK: }
13 
14 template <typename T>
foo(T a)15 constexpr T foo(T a) {
16   return a;
17 }
18