Skip to content

Commit 1c45df8

Browse files
dpiparodevajithvs
authored andcommitted
[TCling] Add test for #8367
1 parent 4d0c9fa commit 1c45df8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

core/metacling/test/TClingTests.cxx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,3 +422,16 @@ TEST_F(TClingTests, RefreshNSShadowing)
422422
gInterpreter->Declare("namespace std { namespace Detail {} }; auto c = TClass::GetClass(\"Detail\");");
423423
gInterpreter->ProcessLine("namespace Detail {}");
424424
}
425+
426+
// #8367
427+
TEST_F(TClingTests, UndeclaredIdentifierCrash)
428+
{
429+
auto expectedError = R"(error: use of undeclared identifier 'i'
430+
for(i=0; i < 0;); // the second usage of `i` was enough to get a segfault
431+
^
432+
)";
433+
using namespace ROOT::TestSupport;
434+
CheckDiagsRAII diagRAII;
435+
diagRAII.requiredDiag(kError, "cling", expectedError, false);
436+
gInterpreter->ProcessLine("for(i=0; i < 0;); // the second usage of `i` was enough to get a segfault");
437+
}

0 commit comments

Comments
 (0)