Job Noorman <jobnoorman@xxxxxxxxx> writes: > When I use the "r" constraint, it indeed works and GCC emits the following > code: > > movl $_ZN3Foo6foobarEv, %eax > push %eax; > > What I find strange about this is that GCC has converted > "(plain_foobar_t)&Foo::foobar" in a constant value ($_ZN3Foo6foobarEv) without > using optimizations. So why can't it do the same when using the "i" > constraint? It can, as you can see, but when not optimizing it won't do it reliably before it determines asm constraints. In other words, there is no simple answer to your question, it's just happenstance of how the compiler is written. It's not a bug, because the compiler only promises to reduce an address to match the "i" constraint when optimizing. Ian