On Sat, 26 May 2012, Jason Merrill wrote:

> In C++, C99 a compound literal creates a temporary object, unlike C, where it
> creates an automatic or static object.  As a result, using an array compound
> literal to initialize a pointer variable leads to undefined behavior, as the
> array's lifetime ends after the declaration statement.  This patch changes the
> C++ front end to reject decay of temporary array compound literals to
> pointers, and the C front end to warn about it with -Wc++-compat.
> 
> Tested x86_64-pc-linux-gnu.  Is the C front-end change OK?

The C front-end change is OK.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to