diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2010-09-17 15:54:40 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2010-09-17 15:54:40 +0000 |
commit | 3d1dcd9bfdb15c49ee34d576a065079ac5c4d29f (patch) | |
tree | 0bbe07708f7571f8b5291f6d7b96c102b7c99dee /test/SemaTemplate/current-instantiation.cpp | |
parent | a0482fa4e7fa27b01184f938097f0666b78016dd (diff) |
Diffstat (limited to 'test/SemaTemplate/current-instantiation.cpp')
-rw-r--r-- | test/SemaTemplate/current-instantiation.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/SemaTemplate/current-instantiation.cpp b/test/SemaTemplate/current-instantiation.cpp index c631dd71d1748..8caac9399a874 100644 --- a/test/SemaTemplate/current-instantiation.cpp +++ b/test/SemaTemplate/current-instantiation.cpp @@ -164,3 +164,38 @@ namespace ConstantInCurrentInstantiation { template<typename T> int X<T>::array[X<T>::value] = { 1, 2 }; } + +namespace Expressions { + template <bool b> + struct Bool { + enum anonymous_enum { value = b }; + }; + struct True : public Bool<true> {}; + struct False : public Bool<false> {}; + + template <typename T1, typename T2> + struct Is_Same : public False {}; + template <typename T> + struct Is_Same<T, T> : public True {}; + + template <bool b, typename T = void> + struct Enable_If {}; + template <typename T> + struct Enable_If<true, T> { + typedef T type; + }; + + template <typename T> + class Class { + public: + template <typename U> + typename Enable_If<Is_Same<U, Class>::value, void>::type + foo(); + }; + + + template <typename T> + template <typename U> + typename Enable_If<Is_Same<U, Class<T> >::value, void>::type + Class<T>::foo() {} +} |