https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111066
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The wording of the warning is different from what dg-warning directive in the testcase expects. diff --git a/gcc/testsuite/g++.dg/special/initpri3.C b/gcc/testsuite/g++.dg/special/initpri3.C index 3d745a42a6a..63ed3208228 100644 --- a/gcc/testsuite/g++.dg/special/initpri3.C +++ b/gcc/testsuite/g++.dg/special/initpri3.C @@ -7,4 +7,4 @@ #endif struct A { A(); } a __attribute__((init_priority(500))); -// { dg-warning "attribute directive ignored" "" { target { ! init_priority } } .-1 } +// { dg-warning "attribute ignored" "" { target { ! init_priority } } .-1 } Is the correct fix I think. The directive in the warning only comes from namespace and using uses.