http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49122

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-05-23 
14:19:40 UTC ---
If we *really* have to use the word broken here, it much better applies to your
snippet, not the implementation of std::initializer_list: an initializer_list
is essentially just a pointer (+ a length) into something else (open the header
and you will see it): thus, f is returning a pointer to the {a, b} which by
itself goes away when f returns. Anything can happen. Compare:

std::initializer_list<int> f(int a, int b)
{
  static auto range = {a, b};
  return range;
}

...

Reply via email to