https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84905

            Bug ID: 84905
           Summary: Improve warning for __attribute__((const)) on function
                    returning void
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Keywords: diagnostic, documentation
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

void __attribute__((const)) f() { }


c.cc:1:31: warning: 'const' attribute on function returning 'void'
[-Wattributes]
 void __attribute__((const)) f() { }
                               ^


A user on IRC complained that this only states a fact, but should say that
using the attribute on void functions doesn't make sense.

It was also pointed out that the new diagnostic is not mentioned in
/gcc-8/changes.html

Reply via email to