aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-07-15 14:37:56 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-07-15 14:37:56 -0400
commit9ee2cecc2fd6a0e4e9633f0a4096b87414635c16 (patch)
treebba1978ce6e87186a4e233762ebed4bbf329f414 /gcc
parentd1dfa20d80f7e2eab9cf18542e41026439b112d0 (diff)
downloadgcc-9ee2cecc2fd6a0e4e9633f0a4096b87414635c16.zip
gcc-9ee2cecc2fd6a0e4e9633f0a4096b87414635c16.tar.gz
gcc-9ee2cecc2fd6a0e4e9633f0a4096b87414635c16.tar.bz2
PR c++/71718 - infinite recursion and alias template
* pt.c (push_tinst_level_loc): Set at_eof before fatal_error. From-SVN: r238387
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/pt.c2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-55.C23
3 files changed, 28 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 81f0a24..1ef3812 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
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.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index a1b0ca9..73b53e2 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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)",
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-55.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-55.C
new file mode 100644
index 0000000..c6d7ae6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-55.C
@@ -0,0 +1,23 @@
+// 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" }