re PR c++/61614 (Bogus error: taking address of temporary array)

/cp
2014-06-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/61614
	* semantics.c (finish_compound_literal): Revert r204228.

/testsuite
2014-06-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/61614
	* g++.dg/ext/complit14.C: New.

From-SVN: r212073
This commit is contained in:
Paolo Carlini 2014-06-27 14:04:28 +00:00 committed by Paolo Carlini
parent 29d7cbd1b9
commit 04d375e604
4 changed files with 21 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2014-06-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/61614
* semantics.c (finish_compound_literal): Revert r204228.
2014-06-27 Paolo Carlini <paolo.carlini@oracle.com>
* parser.c (cp_parser_compound_literal_p): New.

View file

@ -2607,7 +2607,6 @@ finish_compound_literal (tree type, tree compound_literal,
if ((!at_function_scope_p () || CP_TYPE_CONST_P (type))
&& TREE_CODE (type) == ARRAY_TYPE
&& !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
&& !cp_unevaluated_operand
&& initializer_constant_valid_p (compound_literal, type))
{
tree decl = create_temporary_var (type);

View file

@ -1,3 +1,8 @@
2014-06-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/61614
* g++.dg/ext/complit14.C: New.
2014-06-27 Martin Jambor <mjambor@suse.cz>
PR ipa/61160

View file

@ -0,0 +1,11 @@
// PR c++/61614
// { dg-options "" }
int Fn (...);
void
Test ()
{
int j = Fn ((const int[]) { 0 }); // OK
unsigned long sz = sizeof Fn ((const int[]) { 0 }); // Error
}