Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/template/sfinae1.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
rev | line source |
---|---|
111 | 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 } |