title: Spurious warning about binding temporary to reference member in constructor
body: <p>I understand that if a temporary is bound to a reference member in the constructor's initializer list, the object will be destroyed as the constructor returns.</p>
  
  <p><strong>However</strong>, consider the following code:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;functional&gt;
  #include &lt;iostream&gt;
  
  using callback_func = std::function&lt;int(void)&gt;;
  
  int
  func(const callback_func&amp; callback)
  {
    struct wrapper
    {
      const callback_func&amp; w_cb;
      wrapper(const callback_func&amp; cb) : w_cb {cb} { }
      int call() { return this-&gt;w_cb() + this-&gt;w_cb(); }
    };
    wrapper wrp {callback};
    return wrp.call();
  }
  
  int
  main()
  {
    std::cout &lt;&lt; func([](){ return 21; }) &lt;&lt; std::endl;
    return 0;
  }
  </code></pre>
  
  <p>This looks perfectly valid to me.  The <code>callback</code> object will live during the whole execution of the <code>func</code> function and no temporary copy should be made for <code>wrapper</code>'s constructor.</p>
  
  <p>Indeed, <strong>GCC 4.9.0</strong> compiles fine with all warnings enabled.</p>
  
  <p>However, <strong>GCC 4.8.2</strong> compiler gives me the following warning:</p>
  
  <pre class="lang-none prettyprint-override"><code>$ g++ -std=c++11 -W main.cpp 
  main.cpp: In constructor ‘func(const callback_func&amp;)::wrapper::wrapper(const callback_func&amp;)’:
  main.cpp:12:48: warning: a temporary bound to ‘func(const callback_func&amp;)::wrapper::w_cb’ only persists until the constructor exits [-Wextra]
       wrapper(const callback_func&amp; cb) : w_cb {cb} { }
                                              ^
  </code></pre>
  
  <p><strong>Is this a false positive or am I misunderstanding the object lifetimes?</strong></p>
  
  <p>Here are my exact compiler versions tested:</p>
  
  <pre class="lang-none prettyprint-override"><code>$ g++ --version
  g++ (GCC) 4.8.2
  Copyright (C) 2013 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.
  </code></pre>
  
  <pre class="lang-none prettyprint-override"><code>$ g++ --version
  g++ (GCC) 4.9.0 20140604 (prerelease)
  Copyright (C) 2014 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.
  </code></pre>