https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115135
--- Comment #7 from Carlos Alberto Lopez Perez <clopez at igalia dot com> --- Well, I just tested with gcc-11 now and that one works. So the failure was introduced between 11 and 12. $ g++-11 --version g++-11 (Debian 11.3.0-12) 11.3.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ g++-11 -std=c++20 -O3 -fno-exceptions test.cpp && ./a.out [DEBUG] aPtr at 0xffffe61eeee0 points to 0xaaaae4a7e2c0 which has value 10 [At initTest()] [DEBUG] bObj at 0xffffe61eeed0 has value 11 [At initTest()] [DEBUG] aPtr at 0xffffe61eeef0 points to 0xaaaae4a7e2c0 which has value 10 [At doTest():aTest] [DEBUG] bObj at 0xffffe61eeed8 has value 11 [At doTest():aTest] [DEBUG] mObj at 0xffffe61eef68 [At doTest():aTest] [DEBUG] mObj at 0xffffe61eef68 has value 33 [At main()] [OK] Everything went as expected. Program compiled correctly :) $ g++-12 --version g++-12 (Debian 12.2.0-14) 12.2.0 Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ g++-12 -std=c++20 -O3 -fno-exceptions test.cpp && ./a.out [DEBUG] aPtr at 0xffffd052ba00 points to 0xaaaae95d02c0 which has value 10 [At initTest()] [DEBUG] bObj at 0xffffd052b9f0 has value 11 [At initTest()] [DEBUG] aPtr at 0xffffd052ba10 points to 0xffffd052bbc8 which has value -799881990 [At doTest():aTest] [DEBUG] bObj at 0xffffd052b9f8 has value -1136642444 [At doTest():aTest] [DEBUG] mObj at 0xffffd052ba48 [At doTest():aTest] [DEBUG] mObj at 0xffffd052ba48 has value -1936524422 [At main()] [ERROR] Something went wrong compiling the program!: mObj.m_data should be 33 but is -1936524422