title: Can gcc inline an indirect function call through a constant array of function pointers?
body: <p>Let's say we have this code:</p>
  
  <pre><code>inline int func_2 (int a, int b) {
    return time() + a * b;
  }
  
  int main (void) {
    int x = (int (*[])(int, int)){func_1, func_2, func_3}[1](6, 7);
  }
  </code></pre>
  
  <p>Can gcc be somehow tricked to really inline the indirect calls to <code>func_*</code>?</p>
  
  <p>After compiling the code with <code>-O2</code> and <code>-O3</code>, I could still spot a <code>call func_2</code> instruction in the assembly output.</p>
  
  <p>I know this hairy expression can be converted into a bulky <code>switch</code> statement with inlined calls for each case, but I prefer the former for its compactness.</p>