The standard says (7.1.2 ยง 4) "A string literal in an extern inline function is the same object in different translation units". The compiler, not emitting a (generated) symbol, for string literals, cannot guarantee this, resulting in address comparisons on the address of such literals obtained through different instances of the same function to not match. extern inline const char*test() { return "xyz"; } const char*test1(int i) { return test() + i; }
I can confirm this on the mainline (20030825). I think if it generated a named symbol and put it into the linkonce section, this will work.
*** Bug 22459 has been marked as a duplicate of this bug. ***
Suspending based on the fact the DR report is still not fully resolved yet, it is still in drafting phase.
*** Bug 39187 has been marked as a duplicate of this bug. ***
FWIW, it isn't a problem with GNU linker when all files are compiled with the same version of gcc since linker can merge identical strings with gcc help.
The DR is resolved (and is irrelevant to this testcase anyway)