diff options
author | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-09-24 09:58:17 +1000 |
---|---|---|
committer | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-09-24 09:58:17 +1000 |
commit | 222e2a7620e6520ffaf4fc4e69d79c18da31542e (patch) | |
tree | 7bfbc05bfa3b41c8f9d2e56d53a0bc3e310df239 /clang/test/SemaCXX/dependent-noexcept-unevaluated.cpp | |
parent | 3d206f03985b50beacae843d880bccdc91a9f424 (diff) |
Add the clang library to the repo (with some of my changes, too).
Diffstat (limited to 'clang/test/SemaCXX/dependent-noexcept-unevaluated.cpp')
-rw-r--r-- | clang/test/SemaCXX/dependent-noexcept-unevaluated.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/dependent-noexcept-unevaluated.cpp b/clang/test/SemaCXX/dependent-noexcept-unevaluated.cpp new file mode 100644 index 0000000..0a3a8bb --- /dev/null +++ b/clang/test/SemaCXX/dependent-noexcept-unevaluated.cpp @@ -0,0 +1,40 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s + +template <class T> +T&& +declval() noexcept; + +template <class T> +struct some_trait +{ + static const bool value = false; +}; + +template <class T> +void swap(T& x, T& y) noexcept(some_trait<T>::value) +{ + T tmp(static_cast<T&&>(x)); + x = static_cast<T&&>(y); + y = static_cast<T&&>(tmp); +} + +template <class T, unsigned N> +struct array +{ + T data[N]; + + void swap(array& a) noexcept(noexcept(swap(declval<T&>(), declval<T&>()))); +}; + +struct DefaultOnly +{ + DefaultOnly() = default; + DefaultOnly(const DefaultOnly&) = delete; + DefaultOnly& operator=(const DefaultOnly&) = delete; + ~DefaultOnly() = default; +}; + +int main() +{ + array<DefaultOnly, 1> a, b; +} |