summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-09-17 23:57:05 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-09-17 23:57:05 +0000
commit4ff123860b1e90b05bb0f23060b26cd0004569b0 (patch)
tree9e41455397b3651d929b6fca5f1b28ffe7aa439e /clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
parent31c6d3b71e4b15afcf3300336b5da0bb9de3855a (diff)
downloadbcm5719-llvm-4ff123860b1e90b05bb0f23060b26cd0004569b0.tar.gz
bcm5719-llvm-4ff123860b1e90b05bb0f23060b26cd0004569b0.zip
Instantiate exception specifications when instantiating function types (other
than the type of a function declaration). We previously didn't instantiate these at all! This also covers the pathological case where the only mention of a parameter pack is within the exception specification; this gives us a second way (other than alias templates) to reach the horrible state where a type contains an unexpanded pack, but its canonical type does not. llvm-svn: 217995
Diffstat (limited to 'clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp')
-rw-r--r--clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp b/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
index a376f0e5fd5..ae10399b9ad 100644
--- a/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
+++ b/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
@@ -137,3 +137,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