This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/83502] New: [6/7/8 Regression] bogus -Wattributes for always_inline and noinline on function template specialization


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

            Bug ID: 83502
           Summary: [6/7/8 Regression] bogus -Wattributes for
                    always_inline and noinline on function template
                    specialization
           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: ---

Similar to bug 83498, GCC issues a bogus -Wattributes on an explicit
specialization a function template that uses attribute always_inline and where
the primary template is declared noinline.

$ cat u.C && gcc -S -Wall -Wextra u.C
template <class T>
void __attribute__ ((noinline)) f (T) { }

template <>
inline void __attribute__ ((always_inline)) f<int> (int) { }

void fi () { f (0); }
void fs () { f (""); }

u.C:5:56: warning: inline declaration of ‘void f(T) [with T = int]’ follows
declaration with attribute ‘noinline’ [-Wattributes]
 inline void __attribute__ ((always_inline)) f<int> (int) { }
                                                        ^
u.C:2:33: note: previous declaration of ‘void f(T) [with T = int]’ was here
 void __attribute__ ((noinline)) f (T) { }
                                 ^
u.C:5:56: warning: ‘always_inline’ attribute ignored due to conflict with
‘noinline’ attribute [-Wattributes]
 inline void __attribute__ ((always_inline)) f<int> (int) { }
                                                        ^

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]