On Tue, May 11, 2021 at 06:07:19PM +0100, Jonathan Wakely via Gcc-patches wrote: > > I'm not sure if the abort call is necessary since the link step already > > fails with a multiple definition error (without the fix) even if the > > function is defined with an empty body. But since Jakub included an > > abort call in his testcase I carried it over :) Shall I just make it > > dg-do run, or perhaps keep it dg-do link and make the function body > > empty? Either seems to do the right thing. > > OK, if it works as-is then let's leave it as a link test. I think > having the abort there is likely to confuse me again in future when I > forget this conversation, so let's go with an empty body.
When mentioning it on IRC, I didn't think of it failing already at link time, had the mental model of binary + shared library that just exports that symbol, so kind like a small shared library containing that std::to_chars(x, x+64, 42.L, std::chars_format::scientific); in some function, linked with -shared -fpic -static-libstdc++ and then binary with that generic_to_chars function extern "C" and main calling the shared library case. In the end, both that and the dg-do link testcase should catch it fine. Jakub