------- Comment #16 from iains at gcc dot gnu dot org 2010-04-17 10:17 ------- Created an attachment (id=20407) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20407&action=view) alter deprecation tests to eliminate duplicate warnings.
There are actually several constructs that have duplicated warnings. The code below gives duplicates for each of the dg-warning cases shown: I have not succeeded in getting the testsuite to recognize the duplicates (see PR30612), even when putting a single case in one testfile as per the workaround in the PR. So, at present, one has to look at g++.log to confirm that the problems are resolved. === gcc/cp/ChangeLog: gcc/cp/typeck.c(build_class_member_access_expr): Don't check for deprecation here. gcc/cp/call.c(build_call_a): Ditto. (build_over_call): Ditto. (convert_like_real): Check for deprecation here instead. (build_new_method_call): Ditto. === void func(void) __attribute__((deprecated)); void f(void) { func(); // { dg-warning "'void func\\(\\)' is deprecated" "func()" } } struct s1 { int notdep ; int depfield __attribute__((deprecated)); union { int notdep; int deprec __attribute__((deprecated)); } u1 ; union { int notdep1; int notdep2; } u2 __attribute__((deprecated)) ; } ; int main(void) { struct s1 a; int b; b = a.notdep; b += a.depfield; // { dg-warning "'s1::depfield' is deprecated .declared at" "depfield" } b += a.u1.notdep; b += a.u1.deprec; // { dg-warning "'s1::<anonymous union>::deprec' is deprecated .declared at" "s1::u1.deprec" } b += a.u2.notdep1 ;// { dg-warning "'s1::u2' is deprecated .declared at" "s1::u2" } return 0; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17729