Commit 9ee2cecc by Jason Merrill Committed by Jason Merrill

PR c++/71718 - infinite recursion and alias template

	* pt.c (push_tinst_level_loc): Set at_eof before fatal_error.

From-SVN: r238387
parent d1dfa20d
2016-07-15 Jason Merrill <jason@redhat.com>
PR c++/71718
* pt.c (push_tinst_level_loc): Set at_eof before fatal_error.
PR c++/70824
* init.c (constant_value_1): Don't instantiated DECL_INITIAL of
artificial variables.
......
......@@ -9132,6 +9132,8 @@ push_tinst_level_loc (tree d, location_t loc)
if (tinst_depth >= max_tinst_depth)
{
/* Tell error.c not to try to instantiate any templates. */
at_eof = 2;
fatal_error (input_location,
"template instantiation depth exceeds maximum of %d"
" (use -ftemplate-depth= to increase the maximum)",
......
// PR c++/71718
// { dg-do compile { target c++11 } }
template <typename T>
class A : T{};
template <typename T>
using sp = A<T>;
struct Base {};
template <typename T, int num = 1>
const sp<T>
rec() // { dg-error "depth" }
{
return rec<T, num - 1>();
}
static void f(void) {
rec<Base>();
}
// { dg-prune-output "compilation terminated" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment