1 // RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s 2 3 template<template<template<typename> class, typename> class T, template<typename> class V> struct PartialApply { 4 template<typename W> using R = T<V, W>; 5 }; 6 7 template<typename T> using Id = T; 8 template<template<typename> class, typename X> using Zero = X; 9 template<template<template<typename> class, typename> class N, template<typename> class F, typename X> using Succ = F<N<F,X>>; 10 11 template<template<typename> class F, typename X> using One = Succ<Zero, F, X>; 12 template<template<typename> class F, typename X> using Two = Succ<One, F, X>; 13 14 template<template<template<typename> class, typename> class A, 15 template<template<typename> class, typename> class B, 16 template<typename> class F, 17 typename X> using Add = A<F, B<F, X>>; 18 19 template<template<template<typename> class, typename> class A, 20 template<template<typename> class, typename> class B, 21 template<typename> class F, 22 typename X> using Mul = A<PartialApply<B,F>::template R, X>; 23 24 template<template<typename> class F, typename X> using Four = Add<Two, Two, F, X>; 25 template<template<typename> class F, typename X> using Sixteen = Mul<Four, Four, F, X>; 26 template<template<typename> class F, typename X> using TwoHundredAndFiftySix = Mul<Sixteen, Sixteen, F, X>; 27 28 template<typename T, T N> struct Const { static const T value = N; }; 29 template<typename A> struct IncrementHelper; 30 template<typename T, T N> struct IncrementHelper<Const<T, N>> { using Result = Const<T, N+1>; }; 31 template<typename A> using Increment = typename IncrementHelper<A>::Result; 32 33 using Arr = int[TwoHundredAndFiftySix<Increment, Const<int, 0>>::value]; 34 using Arr = int[256]; 35