summaryrefslogtreecommitdiffstats
path: root/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
diff options
context:
space:
mode:
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