From ce9fdd181dd426dea853e56167086f589ee4fca8 Mon Sep 17 00:00:00 2001 From: IOBYTE Date: Sun, 2 Jun 2019 04:23:47 -0400 Subject: [PATCH] Add regression test for #9146 (Syntax error on valid C++ code) (#1867) --- test/testsimplifytemplate.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/testsimplifytemplate.cpp b/test/testsimplifytemplate.cpp index 10688529d..874a278b2 100644 --- a/test/testsimplifytemplate.cpp +++ b/test/testsimplifytemplate.cpp @@ -149,6 +149,7 @@ private: TEST_CASE(template109); // #9144 TEST_CASE(template110); TEST_CASE(template111); // crash + TEST_CASE(template112); // #9146 syntax error TEST_CASE(template_specialization_1); // #7868 - template specialization template struct S> {..}; TEST_CASE(template_specialization_2); // #7868 - template specialization template struct S> {..}; TEST_CASE(template_enum); // #6299 Syntax error in complex enum declaration (including template) @@ -2629,6 +2630,18 @@ private: ASSERT_EQUALS(exp, tok(code)); } + void template112() { // #9146 syntax error + const char code[] = "template struct a;\n" + "template using c = typename a::e;\n" + "template struct f;\n" + "template using g = typename f>::e;"; + const char exp[] = "template < int > struct a ; " + "template < class , class b > using c = typename a < int { b :: d } > :: e ; " + "template < class > struct f ; " + "template < class b > using g = typename f < c < int , b > > :: e ;"; + ASSERT_EQUALS(exp, tok(code)); + } + void template_specialization_1() { // #7868 - template specialization template struct S> {..}; const char code[] = "template struct C {};\n" "template struct S {a};\n"