On Aug 4, 2020, at 3:08 PM, Marek Polacek via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > That works well if you know where to expect an error. But if you don't, it's > worse. E.g., > > // { dg-xfail-if "" { *-*-* } } > int i = nothere; // demonstrates something that errors out > // { dg-error "" } didn't know where to put this > > only prints unexpected failures, but no unexpected successes. I guess that's > OK though, at least for now, so I'll drop dg-accepts-invalid.
There are two cases, either you get an error message that is wrong, and you can use: strncpy (p, s, 60); /* { dg-bogus "-Wstringop-truncation" } */ or, you don't get an error, but you should: A foo(void i = 0); // { dg-error "incomplete type|invalid use" } ? Do you have an example of a specific case that doesn't work? I'm not sure I'm following.