RFC: Monitoring old PRs, new dg directives

Marek Polacek polacek@redhat.com
Wed Aug 5 12:56:30 GMT 2020


On Tue, Aug 04, 2020 at 03:45:11PM -0700, Mike Stump wrote:
> 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.

Sorry for being unclear.  Say you have

// PR c++/55408

struct foo {
    template<int*>
    void bar();
};

template<int*...>
void foo::bar() {}

int main()
{
    extern int i;
    foo {}.bar<&i>();
}

which we wrongly accept.  It might be unclear what line to put that dg-error
on.  So you put it at the end of the file.  Then when we start issuing an error
for the testcase, you will just get a FAIL, not an XPASS.  That might be
confusing if that file isn't in unfixed/.

Maybe it's not a real problem though -- upon inspection you'll find the
dg-error line and just tweak the testcase as needed.

Marek



More information about the Gcc-patches mailing list