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

            Bug ID: 83498
           Summary: bogus -Wattributes for always_inline and noinline on
                    distinct overloads
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

GCC 8 issues a spurious warning for distinct overloads of the same function,
one declared attribute always_inline and the other noinline:

$ cat u.C && gcc -O2 -S -Wall u.C
inline void __attribute__ ((always_inline))
bar () { }

void __attribute__ ((noinline))
bar (int) { }

u.C:5:1: warning: declaration of ‘void bar(int)’ with attribute ‘noinline’
follows inline declaration  [-Wattributes]
 bar (int) { }
 ^~~
u.C:2:1: note: previous definition of ‘void bar()’ was here
 bar () { }
 ^~~

Prior to r255469, GCC would print the following two equally incorrect warnings:

u.C: In function ‘void bar(int)’:
u.C:5:1: warning: function ‘void bar(int)’ redeclared with attribute noinline
[-Wattributes]
 bar (int) { }
 ^~~
u.C:2:1: note: previous declaration of ‘void bar()’ was inline
 bar () { }
 ^~~
u.C:5:1: warning: function ‘void bar(int)’ redeclared with attribute noinline
[-Wattributes]
 bar (int) { }
 ^~~
u.C:2:1: note: previous declaration of ‘void bar()’ was inline
 bar () { }

Reply via email to