summaryrefslogtreecommitdiffstats
path: root/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-01-18 16:23:48 +0000
committerdim <dim@FreeBSD.org>2015-01-18 16:23:48 +0000
commitc86b984ea8ecb3e944dc3de48539f4c1f65851ea (patch)
tree3eb853da77d46cc77c4b017525a422f9ddb1385b /test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
parentc696171ff15f0ee60dea4abfd99a135473c95656 (diff)
downloadFreeBSD-src-c86b984ea8ecb3e944dc3de48539f4c1f65851ea.zip
FreeBSD-src-c86b984ea8ecb3e944dc3de48539f4c1f65851ea.tar.gz
Vendor import of clang RELEASE_360/rc1 tag r226102 (effectively, 3.6.0 RC1):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_360/rc1@226102
Diffstat (limited to 'test/SemaTemplate/instantiate-exception-spec-cxx11.cpp')
-rw-r--r--test/SemaTemplate/instantiate-exception-spec-cxx11.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp b/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
index a376f0e..f62ef61 100644
--- a/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
+++ b/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
@@ -58,6 +58,13 @@ namespace dr1330_example {
S().f<S>(); // ok
S().f<int>(); // expected-note {{instantiation of exception spec}}
}
+
+ template<typename T>
+ struct U {
+ void f() noexcept(T::error);
+ void (g)() noexcept(T::error);
+ };
+ U<int> uint; // ok
}
namespace core_19754_example {
@@ -137,3 +144,37 @@ namespace PR12763 {
};
void X::g() {} // expected-note {{in instantiation of}}
}
+
+namespace Variadic {
+ template<bool B> void check() { static_assert(B, ""); }
+ template<bool B, bool B2, bool ...Bs> void check() { static_assert(B, ""); check<B2, Bs...>(); }
+
+ template<typename ...T> void consume(T...);
+
+ template<typename ...T> void f(void (*...p)() throw (T)) {
+ void (*q[])() = { p... };
+ consume((p(),0)...);
+ }
+ template<bool ...B> void g(void (*...p)() noexcept (B)) {
+ consume((p(),0)...);
+ check<noexcept(p()) == B ...>();
+ }
+ template<typename ...T> void i() {
+ consume([]() throw(T) {} ...);
+ consume([]() noexcept(sizeof(T) == 4) {} ...);
+ }
+ template<bool ...B> void j() {
+ consume([](void (*p)() noexcept(B)) {
+ void (*q)() noexcept = p; // expected-error {{not superset of source}}
+ } ...);
+ }
+
+ void z() {
+ f<int, char, double>(nullptr, nullptr, nullptr);
+ g<true, false, true>(nullptr, nullptr, nullptr);
+ i<int, long, short>();
+ j<true, true>();
+ j<true, false>(); // expected-note {{in instantiation of}}
+ }
+
+}
OpenPOWER on IntegriCloud