[Bug c++/83936] New: [feature request] Allow constexpr char* as target argument

roland at rschulz dot eu gcc-bugzilla@gcc.gnu.org
Thu Jan 18 23:01:00 GMT 2018


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

            Bug ID: 83936
           Summary: [feature request] Allow constexpr char* as target
                    argument
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roland at rschulz dot eu
  Target Milestone: ---

It would be very useful to be able to specify a "constexpr const char*const"
string as an argument to the target attribute. This would allow to specify the
target argument for templates where the target should depend on some template
argument. Example:

struct AVX
{
    static constexpr const char*const target = "avx"; 
};

template<class T>
[[gnu::target(T::target)]]
void test() {}

void f() {
    test<AVX>();
}


More information about the Gcc-bugs mailing list