diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
commit | be1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch) | |
tree | 1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp | |
parent | c4626a62754862d20b41e8a46a3574264ea80e6d (diff) | |
parent | f1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff) |
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp')
-rw-r--r-- | clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp b/clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp new file mode 100644 index 0000000..97457ea --- /dev/null +++ b/clang/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp @@ -0,0 +1,48 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +template<int I, int J, class T> struct X { + static const int value = 0; +}; + +template<int I, int J> struct X<I, J, int> { + static const int value = 1; +}; + +template<int I> struct X<I, I, int> { + static const int value = 2; +}; + +int array0[X<0, 0, float>::value == 0? 1 : -1]; +int array1[X<0, 1, int>::value == 1? 1 : -1]; +int array2[X<0, 0, int>::value == 2? 1 : -1]; + +namespace DependentSubstPartialOrdering { + template<typename T, typename U = void, typename V = void> + struct X { + static const unsigned value = 1; + }; + + template<typename T, typename U> + struct X<T, U, typename T::is_b> { + static const unsigned value = 2; + }; + + template<typename T> + struct X<T, typename T::is_a, typename T::is_b> { + static const unsigned value = 3; + }; + + struct X1 { }; + + struct X2 { + typedef void is_b; + }; + + struct X3 { + typedef void is_a; + typedef void is_b; + }; + + int check_X1[X<X1, void, void>::value == 1? 1 : -1]; + int check_X2[X<X2, void, void>::value == 2? 1 : -1]; + int check_X3[X<X3, void, void>::value == 3? 1 : -1]; +} |