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

            Bug ID: 109506
           Summary: [13 regression] 'error: inlining failed in call to
                    ‘always_inline’ ‘foo<T>::foo() [with T = void]’:
                    function body not available'
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

```
$ cat /tmp/foo.cxx
template <typename T> struct foo {
  __attribute__((__always_inline__)) foo() {};
};
template <typename T> class bar {
  foo<void> alloc_ {};
};
template <typename... A>
void func1(A &&...) {
  bar<void>();
}
void func2() {
  func1();
}

$ g++ -c -std=c++20 /tmp/foo.cxx
/tmp/foo.cxx: In constructor ‘constexpr bar<void>::bar()’:
/tmp/foo.cxx:2:38: error: inlining failed in call to ‘always_inline’
‘foo<T>::foo() [with T = void]’: function body not available
    2 |   __attribute__((__always_inline__)) foo() {};
      |                                      ^~~
/tmp/foo.cxx:4:29: note: called from here
    4 | template <typename T> class bar {
      |                             ^~~

$ g++ --version
g++ (Gentoo Hardened 13.0.1_pre20230409-r4 p9) 13.0.1 20230409 (experimental)
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```

It compiles if the template on func1 is removed.

This works with 12 and Arsen reports that an earlier 13 is ok, but not had a
chance to bisect yet.

Reply via email to