https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122905
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|lto |c++
Keywords| |needs-reduction
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
```
g++ -fPIC -O3 -std=c++17 -c a.cc -flto
g++ -fPIC -O3 -std=c++17 -c b.cc -flto -save-temps # To get b.ii
g++ -fPIC -O3 -std=c++20 -c b.ii -flto
g++ -fPIC -O3 -flto=1 -shared -o t.so a.o b.o -W -Wall -Werror=odr
-Werror=lto-type-mismatch
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
```
So this was my next step of doing something. compile the -std=c++20 with the
preprocessed source from C++17 and there is a failure there. So I might be able
to get a reduced testcase ...
Let me try.