https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122905
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Simplified comands:
```
g++ -fPIC -O3 -std=c++17 -c a.cc -flto
g++ -fPIC -O3 -std=c++20 -c a.cc -flto
g++ -fPIC -O3 -flto=1 -shared -o t.so a.o b.o -W -Wall -Werror=odr
-Werror=lto-type-mismatch
```
Result:
```
a.h:6:13: error: ‘example’ violates the C++ One Definition Rule [-Werror=odr]
6 | std::string example();
| ^
a.cc:3:13: note: return value type mismatch
3 | std::string example()
| ^
a.cc:3:13: note: type ‘struct string’ itself violates the C++ One Definition
Rule
a.cc:3:13: note: ‘example’ was previously declared here
lto1: some warnings being treated as errors
lto-wrapper: fatal error: /home/apinski/upstream-gcc/bin/g++ returned 1 exit
status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
```