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

--- Comment #13 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Erez Strauss from comment #12)
> https://compiler-explorer.com/z/qPG6x8efK
> 
> See the same C++ code:
>  - works with clang, 
>  - fails with gcc :-(
> 
> It fails with gcc-trunk ...
> sections(".init_array") fails to add the needed attribute of the section.
> The bug should be re-opened.
This is a different bug that can be demonstrated using ordinary inline
functions instead of templates:

void f() {
  [[gnu::section(".test")]] static int p = 42;
}

inline void g() {
  [[gnu::used, gnu::section(".test")]] static int p = 0;
}

int main() {
  f(); // non-inline
  g(); // inline
}

// error: 'p' causes a section type conflict with 'p'

Could you file a new PR for this issue?

Reply via email to