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

--- Comment #18 from Paul Pluzhnikov <ppluzhnikov at google dot com> 2012-06-20 
01:59:01 UTC ---
FWIW, it appears that the new error is too strict. It rejects this source,
which (AFAIU) is entirely kosher:

#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 } );
                                     ^

Still, I prefer to rewrite the case above, then to debug undiagnosed runtime
problems from the original test case.

Reply via email to