https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41373
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|UNCONFIRMED |NEW Last reconfirmed| |2017-02-07 CC| |msebor at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- Confirmed with recent trunk of GCC 7. The instantiation context should be present in all diagnostics. $ cat t.C && gcc -S -Wall t.C void f (int) __attribute__ ((error ("error"))); void f (double) __attribute__ ((warning ("warning"))); void f (void*) __attribute__ ((deprecated)); template <class T> void g () { f (T ()); } int main () { g<int>(); g<double>(); g<void*>(); } t.C: In instantiation of ‘void g() [with T = void*]’: t.C:15:12: required from here t.C:8:5: warning: ‘void f(void*)’ is deprecated [-Wdeprecated-declarations] f (T ()); ~~^~~~~~ t.C:3:6: note: declared here void f (void*) __attribute__ ((deprecated)); ^ t.C: In function ‘void g() [with T = int]’: t.C:8:5: error: call to ‘f’ declared with attribute error: error f (T ()); ~~^~~~~~ t.C: In function ‘void g() [with T = double]’: t.C:8:5: warning: call to ‘f’ declared with attribute warning: warning f (T ()); ~~^~~~~~