[Bug c++/81276] New: Function multiversioning doesn't work with C++ templates
sgunderson at bigfoot dot com
gcc-bugzilla@gcc.gnu.org
Sun Jul 2 08:45:00 GMT 2017
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.
More information about the Gcc-bugs
mailing list