PR12298 et al: don't recursively instantiate a template specialization from
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 31 Aug 2016 02:15:21 +0000 (02:15 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 31 Aug 2016 02:15:21 +0000 (02:15 +0000)
commit54f18e8a857094a608e63924d38d51b5964f2eab
tree011c16ee16493d6df009f6a2922af06cd2baa1b5
parent5ed6fe739f74aca51cf6d52c545283db68034077
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
clang/include/clang/AST/DeclTemplate.h
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/test/SemaTemplate/instantiate-self.cpp
clang/test/SemaTemplate/instantiation-depth-exception-spec.cpp
clang/test/SemaTemplate/instantiation-depth.cpp