[cfe-dev] C++ Test Suite

Doug Gregor doug.gregor at gmail.com
Thu Oct 16 16:54:08 PDT 2008

Hi Sebastian,

On Thu, Oct 16, 2008 at 5:09 PM, Sebastian Redl
<sebastian.redl at getdesigned.at> wrote:
> I just finished an initial implementation of semantic checks for
> reinterpret_cast,


> but I have the nagging feeling that I've got a lot of
> corner cases wrong.
> Now, since I wrote the code and since I'm note sure about these corner
> cases, I feel like I'm the wrong person to write test cases for the
> functionality.

Did you try all of the reinterpret_cast examples from the standard?
Those are good for a quick sanity check.

> Does anyone know of a proper set of test cases for C++ that we can use?
> I looked at GCC's test suite, but it doesn't have many test cases for this.

There really aren't any good, free C++ test suites out there. As
you've noted, GCC's test suite is sparse, and the only more
comprehensive test suites are commercial (and expensive).The best test
suites are large C++ applications, but of course we're not to the
point where we can handle those, yet.

> Failing that, is anyone willing to sit down and write a set of test
> cases for reinterpret_cast?

Oddly enough, I was thinking about this kind of thing today, and I
have a similar distrust of my tests for the basic overloading patch I
sent a while back. It would be a great practice for building out our
test suite if we wrote tests for those features that we didn't
implement, because we're more likely to catch bugs if we don't know
how the implementation works.

So, if someone has some time, I hope they step up and write some tests
for reinterpret_cast. I'll volunteer to write (more) tests for your
const_cast patch (and then review it) within the next week.

  - Doug

More information about the cfe-dev mailing list