summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/instantiation-depth.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-08-31 02:15:21 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-08-31 02:15:21 +0000
commit54f18e8a857094a608e63924d38d51b5964f2eab (patch)
tree011c16ee16493d6df009f6a2922af06cd2baa1b5 /clang/test/SemaTemplate/instantiation-depth.cpp
parent5ed6fe739f74aca51cf6d52c545283db68034077 (diff)
downloadbcm5719-llvm-54f18e8a857094a608e63924d38d51b5964f2eab.tar.gz
bcm5719-llvm-54f18e8a857094a608e63924d38d51b5964f2eab.zip
PR12298 et al: don't recursively instantiate a template specialization from
within the instantiation of that same specialization. This could previously happen for eagerly-instantiated function templates, variable templates, exception specifications, default arguments, and a handful of other cases. We still have an issue here for default template arguments that recursively make use of themselves and likewise for substitution into the type of a non-type template parameter, but in those cases we're producing a different entity each time, so they should instead be caught by the instantiation depth limit. However, currently we will typically run out of stack before we reach it. :( llvm-svn: 280190
Diffstat (limited to 'clang/test/SemaTemplate/instantiation-depth.cpp')
-rw-r--r--clang/test/SemaTemplate/instantiation-depth.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/test/SemaTemplate/instantiation-depth.cpp b/clang/test/SemaTemplate/instantiation-depth.cpp
index c0b8bb2a124..17f84c170c3 100644
--- a/clang/test/SemaTemplate/instantiation-depth.cpp
+++ b/clang/test/SemaTemplate/instantiation-depth.cpp
@@ -19,13 +19,12 @@ void test() {
// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-depth 5 -ftemplate-backtrace-limit 4 -std=c++11 -DNOEXCEPT %s
template<typename T> struct S {
- S() noexcept(noexcept(T()));
-};
-struct T : S<T> {}; \
+ S() noexcept(noexcept(S<S>())); \
// expected-error{{recursive template instantiation exceeded maximum depth of 5}} \
-// expected-note 4 {{in instantiation of exception spec}} \
+// expected-note 3 {{in instantiation of exception spec}} \
// expected-note {{skipping 2 contexts in backtrace}} \
// expected-note {{use -ftemplate-depth=N to increase recursive template instantiation depth}}
-T t; // expected-note {{implicit default constructor for 'T' first required here}}
+};
+S<void> t; // expected-note {{in instantiation of exception spec}}
#endif
OpenPOWER on IntegriCloud