This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/81276] New: Function multiversioning doesn't work with C++ templates
- From: "sgunderson at bigfoot dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 02 Jul 2017 08:44:53 +0000
- Subject: [Bug c++/81276] New: Function multiversioning doesn't work with C++ templates
- Auto-submitted: auto-generated
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.