diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-09-10 20:55:50 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-09-10 20:55:50 +0000 |
commit | dbd14bdefce47ff7bce4aa976eb4f883f0e53a74 (patch) | |
tree | b6d12373365833bf1768b373098f708e7b4c5a27 /clang/test/CXX/expr/expr.unary/expr.unary.noexcept | |
parent | 5f0180d815ddc131371e65d7efb942d0573a21d3 (diff) | |
download | bcm5719-llvm-dbd14bdefce47ff7bce4aa976eb4f883f0e53a74.tar.gz bcm5719-llvm-dbd14bdefce47ff7bce4aa976eb4f883f0e53a74.zip |
Tests for noexcept in templates.
llvm-svn: 113625
Diffstat (limited to 'clang/test/CXX/expr/expr.unary/expr.unary.noexcept')
-rw-r--r-- | clang/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/clang/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp b/clang/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp index c1865fc4ff3..e4025d9e2ff 100644 --- a/clang/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp +++ b/clang/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp @@ -2,6 +2,7 @@ #define P(e) static_assert(noexcept(e), "expected nothrow") #define N(e) static_assert(!noexcept(e), "expected throw") +#define B(b, e) static_assert(b == noexcept(e), "expectation failed") void simple() { P(0); @@ -126,3 +127,33 @@ void uneval() { P(sizeof(typeid(*(V*)0))); P(typeid(typeid(*(V*)0))); } + +struct G1 {}; +struct G2 { int i; }; +struct G3 { S2 s; }; + +void gencon() { + P(G1()); + P(G2()); + N(G3()); +} + +template <typename T, bool b> +void late() { + B(b, typeid(*(T*)0)); + B(b, T(1)); + B(b, static_cast<T>(S2(0, 0))); + B(b, S1() + T()); +} +struct S3 { + virtual ~S3() throw(); + S3() throw(); + explicit S3(int); + S3(const S2&); +}; +void operator +(const S1&, float) throw(); +void operator +(const S1&, const S3&); +void tlate() { + late<float, true>(); + late<S3, false>(); +} |