From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/SemaTemplate/alias-church-numerals.cpp | 34 +++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 clang/test/SemaTemplate/alias-church-numerals.cpp (limited to 'clang/test/SemaTemplate/alias-church-numerals.cpp') diff --git a/clang/test/SemaTemplate/alias-church-numerals.cpp b/clang/test/SemaTemplate/alias-church-numerals.cpp new file mode 100644 index 0000000..69d7716 --- /dev/null +++ b/clang/test/SemaTemplate/alias-church-numerals.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +template class, typename> class T, template class V> struct PartialApply { + template using R = T; +}; + +template using Id = T; +template class, typename X> using Zero = X; +template class, typename> class N, template class F, typename X> using Succ = F>; + +template class F, typename X> using One = Succ; +template class F, typename X> using Two = Succ; + +template class, typename> class A, + template class, typename> class B, + template class F, + typename X> using Add = A>; + +template class, typename> class A, + template class, typename> class B, + template class F, + typename X> using Mul = A::template R, X>; + +template class F, typename X> using Four = Add; +template class F, typename X> using Sixteen = Mul; +template class F, typename X> using TwoHundredAndFiftySix = Mul; + +template struct Const { static const T value = N; }; +template struct IncrementHelper; +template struct IncrementHelper> { using Result = Const; }; +template using Increment = typename IncrementHelper::Result; + +using Arr = int[TwoHundredAndFiftySix>::value]; +using Arr = int[256]; -- cgit v1.2.3