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++/81276] New: Function multiversioning doesn't work with C++ templates


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

            Bug ID: 81276
           Summary: Function multiversioning doesn't work with C++
                    templates
           Product: gcc
           Version: 7.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sgunderson at bigfoot dot com
  Target Milestone: ---

Hi,

Seemingly one can't ask for a template to be multiversioned:

template<class T>
__attribute__ ((target("default")))
void func(T *x) {}

template<class T>
__attribute__ ((target("arch=haswell")))
void func(T *x) {}

gives, when compiled:

func.cpp:7:6: error: ambiguating new declaration ‘template<class T> void
func(T*)’
 void func(T *x) {}
      ^~~~
func.cpp:3:6: note: old declaration ‘template<class T> void func(T*)’
 void func(T *x) {}
      ^~~~

target_clones works, but is useless for me because it turns off inlining.

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