https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123526
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:17af6bff039c464c305d58f22b447ce6745652ca commit r16-6705-g17af6bff039c464c305d58f22b447ce6745652ca Author: Jakub Jelinek <[email protected]> Date: Mon Jan 12 10:05:50 2026 +0100 c++: Remove gnu::gnu_inline attribute on inheriting ctors [PR123526] The recent addition of gnu::gnu_inline attributes to some C++26 constexpr methods broke classes which inherit e.g. from std::logic_error or other C++26 classes with gnu::gnu_inline constructors and use inheriting constructors. On std::logic_error etc. it has the desired effect that the ctor itself can be constexpr evaluated and even inlined, but is not emitted in each TU that needs it and didn't inline it, but is still contained in libstdc++.{a,so.6}. Unfortunately inheriting ctors inherit also attributes of the corresponding ctors except those that clone_attrs filter out and that includes the gnu_inline attribute if explicitly specified on the base class ctor. That has the undesirable effect that the implementation detail of e.g. the std::logic_error class leaks into the behavior of a class that inherits from it if it is using inheriting constructors, those will result in undefined symbols for the inheriting constructors if they aren't inlined, unless one also inherits from it in some TU without gnu_inline there (e.g. one compiled with -std=c++23 or earlier). So, the following patch fixes it by removing the gnu::gnu_inline attribute from the inheriting constructor. Not done in clone_attrs because that function is also used for the normal constructor cloning and in that case we do want to clone those attributes. 2026-01-12 Jakub Jelinek <[email protected]> PR c++/123526 * method.cc: Include attribs.h. (implicitly_declare_fn): Remove gnu::gnu_inline attribute. * g++.dg/ext/gnu-inline-inh-ctor1.C: New test. * g++.dg/ext/gnu-inline-inh-ctor2.C: New test.
