[Bug c++/53220] [4.7/4.8 Regression] g++ mis-compiles compound literals

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Apr 4 12:41:00 GMT 2016


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

--- Comment #22 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The added diagnostic rejects this, which clang and EDG accept:

extern "C" int printf(const char*, ...);
int main() { 
  using A = int[1];
  printf("%p\n", A{1} );
}

ts.c:4:18: error: taking address of temporary array
   printf("%p\n", A{1} );
                  ^~~~


This doesn't use compound literals, and seems like valid C++ according to
[conv.array].


More information about the Gcc-bugs mailing list