This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53220] [4.7/4.8 Regression] g++ mis-compiles compound literals
- From: "superaxioma at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 01 May 2013 09:54:43 +0000
- Subject: [Bug c++/53220] [4.7/4.8 Regression] g++ mis-compiles compound literals
- Auto-submitted: auto-generated
- References: <bug-53220-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53220
superaxioma at hotmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |superaxioma at hotmail dot
| |com
--- Comment #20 from superaxioma at hotmail dot com 2013-05-01 09:54:43 UTC ---
(In reply to comment #18)
> #include <stdio.h>
>
> void fn(int arr[])
> {
> for (int j = 0; j < 5; ++j)
> printf("%d: %d\n", j, arr[j]);
> }
>
> int main()
> {
> fn((int[]) { 41, 42, 43, 44, 45 } );
> return 0;
> }
>
> g++ -c t.cc
> t.cc: In function âint main()â:
> t.cc:11:37: error: taking address of temporary array
> fn((int[]) { 41, 42, 43, 44, 45 } );
I wrote some code which compiled perfectly using gcc 4.7. However, now I am
using gcc 4.8 and I am encountering exactly the problem mentioned by Paul. Will
this be solved or should I look for another solution to overcome this problem?
Any suggestions?