Debian Codegraph @

gcc/testsuite/g++.dg/template/sfinae1.C

raw
1 // PR c++/14337
2
3 template <bool> struct Constraint;
4 template <> struct Constraint<true> { typedef int Result; };
5
6 template <typename T>
7 struct IsInt { static const bool value = false; };
8
9 template <>
10 struct IsInt<int> { static const bool value = true; };
11
12 template <typename T>
13 typename Constraint<IsInt<T>::value>::Result foo(T);
14
15 template <typename T>
16 typename Constraint<!IsInt<T>::value>::Result foo(T);
17
18 template <typename>
19 void bar() {
20 foo(1);
21 }