summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/instantiate-local-class.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2013-11-27 22:57:44 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2013-11-27 22:57:44 +0000
commitfd6c685f2e937d3e3a5b37f9da556c52134e7c35 (patch)
treea77c9ee15437c6d9be6d56c84181a2e7c6f60e84 /clang/test/SemaTemplate/instantiate-local-class.cpp
parente3d6bcf5e0807174ece51251fd5893bda8ed2e9c (diff)
downloadbcm5719-llvm-fd6c685f2e937d3e3a5b37f9da556c52134e7c35.tar.gz
bcm5719-llvm-fd6c685f2e937d3e3a5b37f9da556c52134e7c35.zip
Sema: Instantiation of variable definitions weren't local enough
We wouldn't properly save and restore the pending local instantiations we had built up prior to instantiation of a variable definition. This would lead to us instantiating too much causing crashes and other general badness. This fixes PR14374. llvm-svn: 195887
Diffstat (limited to 'clang/test/SemaTemplate/instantiate-local-class.cpp')
-rw-r--r--clang/test/SemaTemplate/instantiate-local-class.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/instantiate-local-class.cpp b/clang/test/SemaTemplate/instantiate-local-class.cpp
index 2b5db0fda3e..bdc5ea0d4a8 100644
--- a/clang/test/SemaTemplate/instantiate-local-class.cpp
+++ b/clang/test/SemaTemplate/instantiate-local-class.cpp
@@ -160,3 +160,23 @@ void call() {
C::func([]() {});
}
}
+
+namespace PR14373 {
+ struct function {
+ template <typename _Functor> function(_Functor __f) { __f(); }
+ };
+ template <typename Func> function exec_func(Func f) {
+ struct functor {
+ functor(Func f) : func(f) {}
+ void operator()() const { func(); }
+ Func func;
+ };
+ return functor(f);
+ }
+ struct Type {
+ void operator()() const {}
+ };
+ int call() {
+ exec_func(Type());
+ }
+}
OpenPOWER on IntegriCloud