diff --git a/core/metacling/test/TClingTests.cxx b/core/metacling/test/TClingTests.cxx index 171bd3322092c..ad3582be3082f 100644 --- a/core/metacling/test/TClingTests.cxx +++ b/core/metacling/test/TClingTests.cxx @@ -435,3 +435,19 @@ TEST_F(TClingTests, UndeclaredIdentifierCrash) diagRAII.requiredDiag(kError, "cling", expectedError, false); gInterpreter->ProcessLine("for(i=0; i < 0;); // the second usage of `i` was enough to get a segfault"); } + +// https://github.com/root-project/root/issues/15818 +TEST_F(TClingTests, VeryLongExpression) +{ + std::string expression = R"( +namespace R_rdf { +auto func0(const int var0){return var0 )"; + for (unsigned short i = 0; i < 4096; ++i) + expression += "+ var0 "; + expression += R"( > 0 +;} +using func0_ret_t = typename ROOT::TypeTraits::CallableTraits::ret_type; +})"; + auto res = gInterpreter->Declare(expression.c_str()); + EXPECT_TRUE(res); +}