Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] codan test does not fail if StackOverflowError is thrown

I tried to add the following test to AbstractClassInstantiationCheckerTest.java:

    //  template <int I>
    //  struct S : S<I - 1> {};
    //
    //  S<1> waldo;
    public void testMaxInstantiationDepth_430282() throws Exception {
        // Just check that codan runs without any exceptions being thrown.
        loadCodeAndRun(getAboveComment());
    }

Running AbstractClassInstantiationChecker on this code causes infinite
recursion in SemanticQueries.PureVirtualMethodCollector.collectFinalOverriders(),
leading to a StackOverflowError (this is the bug I am writing the test for).

I would expect that this causes the test to fail; however, the test succeeds.
(I know the exception is being thrown because I can see it in the Console
when I run the test.)

How can I write a test that fails if StackOverflowError is thrown?

Thanks,
Nate 		 	   		  

Back to the top