diff options
author | dim <dim@FreeBSD.org> | 2012-08-15 20:02:54 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-08-15 20:02:54 +0000 |
commit | 554bcb69c2d785a011a30e7db87a36a87fe7db10 (patch) | |
tree | 9abb1a658a297776086f4e0dfa6ca533de02104e /test/SemaCXX/alias-template.cpp | |
parent | bb67ca86b31f67faee50bd10c3b036d65751745a (diff) | |
download | FreeBSD-src-554bcb69c2d785a011a30e7db87a36a87fe7db10.zip FreeBSD-src-554bcb69c2d785a011a30e7db87a36a87fe7db10.tar.gz |
Vendor import of clang trunk r161861:
http://llvm.org/svn/llvm-project/cfe/trunk@161861
Diffstat (limited to 'test/SemaCXX/alias-template.cpp')
-rw-r--r-- | test/SemaCXX/alias-template.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/SemaCXX/alias-template.cpp b/test/SemaCXX/alias-template.cpp index 484dd33..4bf79f8 100644 --- a/test/SemaCXX/alias-template.cpp +++ b/test/SemaCXX/alias-template.cpp @@ -145,3 +145,30 @@ namespace Curried { template<typename T, typename U> struct S; template<typename T> template<typename U> using SS = S<T, U>; // expected-error {{extraneous template parameter list in alias template declaration}} } + +// PR12647 +namespace SFINAE { + template<bool> struct enable_if; // expected-note 2{{here}} + template<> struct enable_if<true> { using type = void; }; + + template<typename T> struct is_enum { static constexpr bool value = __is_enum(T); }; + + template<typename T> using EnableIf = typename enable_if<T::value>::type; // expected-error {{undefined template}} + template<typename T> using DisableIf = typename enable_if<!T::value>::type; // expected-error {{undefined template}} + + template<typename T> EnableIf<is_enum<T>> f(); + template<typename T> DisableIf<is_enum<T>> f(); + + enum E { e }; + + int main() { + f<int>(); + f<E>(); + } + + template<typename T, typename U = EnableIf<is_enum<T>>> struct fail1 {}; // expected-note {{here}} + template<typename T> struct fail2 : DisableIf<is_enum<T>> {}; // expected-note {{here}} + + fail1<int> f1; // expected-note {{here}} + fail2<E> f2; // expected-note {{here}} +} |