https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63657
petschy at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|DUPLICATE |--- --- Comment #5 from petschy at gmail dot com --- To further prove my case, here is the disassembly of foo() and bar(). As expected, they are identical, no ctors/dtors are ever called, so there can be no side effects. Dump of assembler code for function foo(): 0x0000000000400766 <+0>: push %rbp 0x0000000000400767 <+1>: mov %rsp,%rbp 0x000000000040076a <+4>: sub $0x10,%rsp 0x000000000040076e <+8>: callq 0x400797 <getfoo()> 0x0000000000400773 <+13>: mov %rax,-0x8(%rbp) 0x0000000000400777 <+17>: leaveq 0x0000000000400778 <+18>: retq End of assembler dump. Dump of assembler code for function bar(): 0x0000000000400779 <+0>: push %rbp 0x000000000040077a <+1>: mov %rsp,%rbp 0x000000000040077d <+4>: sub $0x10,%rsp 0x0000000000400781 <+8>: callq 0x4007a2 <getbar()> 0x0000000000400786 <+13>: mov %rax,-0x8(%rbp) 0x000000000040078a <+17>: leaveq 0x000000000040078b <+18>: retq End of assembler dump.