File: func_template_9.ispc

package info (click to toggle)
ispc 1.28.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 97,620 kB
  • sloc: cpp: 77,067; python: 8,303; yacc: 3,337; lex: 1,126; ansic: 631; sh: 475; makefile: 17
file content (19 lines) | stat: -rw-r--r-- 787 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Check that explicit instantiation picks the right version of the template.

// RUN: %{ispc} %s --nostdlib --target=host --ast-dump -o %t.o | FileCheck %s


template <typename T> T foo(T a) { return a; }
template <typename T> T foo(T a, T b) { return a+b; }
template <typename T> T foo(T a, int b) { return a+b; }

template <typename T> T goo(T a) { return a; }
template <typename T> T goo(T a, T b) { return a+b; }
template <typename T> T goo(T a, int b) { return a+b; }

// CHECK: (instantiation <varying float>) Function {{.*}} [ varying float(varying float a, varying float b)] "foo"
template float foo<float>(float, float);

// CHECK: (instantiation <varying float>) Function {{.*}} [ varying float(varying float a, varying int32 b)] "goo"
template float goo<float>(float, int);