[Bug c++/47461] New: warn_unused_result attribute ignored for templates

ian at airs dot com gcc-bugzilla@gcc.gnu.org
Tue Jan 25 16:45:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47461

           Summary: warn_unused_result attribute ignored for templates
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ian@airs.com


When I compile this C++ code with current mainline


class C {
 public:
  template<typename T> bool f(T* m) __attribute__((warn_unused_result));
};
template<typename T> inline bool C::f(T* m) { return true; }
void f(C* pc) { int i; pc->f(&i); }

I should see a warning for the call to pc->f.  However, I see no warnings.

I do see a warning for a member function which is not a template.



More information about the Gcc-bugs mailing list