diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-01-26 16:50:54 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-01-26 16:50:54 +0000 |
commit | 54e462ac6ec9140c75d670cfa640ffb0aded114c (patch) | |
tree | 535e165bf099dc82606e6c582ac6dad43d837500 /clang/test | |
parent | 1d042091d39c3bb796ae2cc3c47b7d5692431e40 (diff) | |
download | bcm5719-llvm-54e462ac6ec9140c75d670cfa640ffb0aded114c.tar.gz bcm5719-llvm-54e462ac6ec9140c75d670cfa640ffb0aded114c.zip |
Rvalue references for *this: tentative parsing and template argument deduction.
llvm-svn: 124295
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp b/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp new file mode 100644 index 00000000000..a9173fd6be8 --- /dev/null +++ b/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp @@ -0,0 +1,47 @@ +// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s + +// Deductions specific to C++0x. + +template<typename T> +struct member_pointer_kind { + static const unsigned value = 0; +}; + +template<class C, typename R, typename ...Args> +struct member_pointer_kind<R (C::*)(Args...)> { + static const unsigned value = 1; +}; + +template<class C, typename R, typename ...Args> +struct member_pointer_kind<R (C::*)(Args...) &> { + static const unsigned value = 2; +}; + +template<class C, typename R, typename ...Args> +struct member_pointer_kind<R (C::*)(Args...) &&> { + static const unsigned value = 3; +}; + +template<class C, typename R, typename ...Args> +struct member_pointer_kind<R (C::*)(Args...) const> { + static const unsigned value = 4; +}; + +template<class C, typename R, typename ...Args> +struct member_pointer_kind<R (C::*)(Args...) const &> { + static const unsigned value = 5; +}; + +template<class C, typename R, typename ...Args> +struct member_pointer_kind<R (C::*)(Args...) const &&> { + static const unsigned value = 6; +}; + +struct X { }; + +static_assert(member_pointer_kind<int (X::*)(int)>::value == 1, ""); +static_assert(member_pointer_kind<int (X::*)(int) &>::value == 2, ""); +static_assert(member_pointer_kind<int (X::*)(int) &&>::value == 3, ""); +static_assert(member_pointer_kind<int (X::*)(int) const>::value == 4, ""); +static_assert(member_pointer_kind<int (X::*)(int) const&>::value == 5, ""); +static_assert(member_pointer_kind<int (X::*)(int) const&&>::value == 6, ""); |