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

            Bug ID: 110258
           Summary: Undefined reference to intrinsic when taking function
                    reference at namespace scope
           Product: gcc
           Version: 13.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: magnus.hegdahl at gmail dot com
  Target Milestone: ---

Tested on g++ (GCC) 13.1.1 20230429 on Linux

```
#include <x86intrin.h>

// this doesn't work in GCC (but does in clang)
constexpr auto set1 = _mm_set1_epi32;

// this works
struct S {
  static constexpr auto set1 = _mm_set1_epi32;
};

int main() {
  // and this works
  _mm_set1_epi32(1);
}
```

output:
/usr/bin/ld: /tmp/ccaN0gLC.o:(.data.rel.ro+0x0): undefined reference to
`_mm_set1_epi32(int)'
collect2: error: ld returned 1 exit status

The code seems to work as expected with other function pointers,
even when defined in other translation units.
I've only seen the problem with intrinsics.
  • [Bug c++/110258] New: Undefin... magnus.hegdahl at gmail dot com via Gcc-bugs

Reply via email to