Skip to content

Commit

Permalink
[TCling] Add test for #8367
Browse files Browse the repository at this point in the history
  • Loading branch information
dpiparo authored and devajithvs committed Oct 31, 2024
1 parent f3fffbb commit 8f63509
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions core/metacling/test/TClingTests.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -422,3 +422,16 @@ TEST_F(TClingTests, RefreshNSShadowing)
gInterpreter->Declare("namespace std { namespace Detail {} }; auto c = TClass::GetClass(\"Detail\");");
gInterpreter->ProcessLine("namespace Detail {}");
}

// #8367
TEST_F(TClingTests, UndeclaredIdentifierCrash)
{
auto expectedError = R"(error: use of undeclared identifier 'i'
for(i=0; i < 0;); // the second usage of `i` was enough to get a segfault
^
)";
using namespace ROOT::TestSupport;
CheckDiagsRAII diagRAII;
diagRAII.requiredDiag(kError, "cling", expectedError, false);
gInterpreter->ProcessLine("for(i=0; i < 0;); // the second usage of `i` was enough to get a segfault");
}

0 comments on commit 8f63509

Please sign in to comment.