On Mon, 24 Nov 2025 at 14:28, Yuao Ma <[email protected]> wrote: > > Hi Jonathan, > > On Mon, Nov 24, 2025 at 6:19 PM Jonathan Wakely <[email protected]> wrote: > > > > This means we don't need to add the new member to the explicit > > instantiation definition. > > > > libstdc++-v3/ChangeLog: > > > > * include/std/istream (istream::ignore(streamsize, char)): Add > > always_inline attribute. > > --- > > > > Tested x86_64-linux. Pushed to trunk. > > > > libstdc++-v3/include/std/istream | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/libstdc++-v3/include/std/istream > > b/libstdc++-v3/include/std/istream > > index 285c41cf02ba..ea232a71f5a8 100644 > > --- a/libstdc++-v3/include/std/istream > > +++ b/libstdc++-v3/include/std/istream > > @@ -556,6 +556,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > > ignore(); > > > > #if __cplusplus > 202302L > > + [[__gnu__::__always_inline__]] > > __istream_type& > > ignore(streamsize __n, char __delim) requires same_as<_CharT, char> > > { return ignore(__n, traits_type::to_int_type(__delim)); } > > -- > > 2.51.1 > > > > Thanks a lot for the quick fix! I saw the explicit initialization in > istream.tcc; I realize now that I should have added that (or used > always_inline). > > I do have a couple of questions, though: > 1. Why is always_inline required here? My understanding was that > functions defined within a class are implicitly inlined.
No, functions within a class are implicitly 'inline functions'. That doesn't mean the compiler actually inlines them, it just means the definition is provided in the header and *can* be inlined. The attribute forces the compiler to inline it. > 2. Do you know why my test case didn't catch this failure? The testsuite runs with -O2 and so the function was inlined in those tests. It was not inlined for -O0, but that's what the always_inline attribute changes. > > * * * > > Also, it would be great if you could help review > https://gcc.gnu.org/pipermail/libstdc++/2025-November/064522.html. I > believe I have addressed all the previous comments there. > > Thanks, > Yuao >
