From 04d375e6046cdaa59d74f666c13570c6eb420cdc Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 27 Jun 2014 14:04:28 +0000 Subject: [PATCH] re PR c++/61614 (Bogus error: taking address of temporary array) /cp 2014-06-27 Paolo Carlini PR c++/61614 * semantics.c (finish_compound_literal): Revert r204228. /testsuite 2014-06-27 Paolo Carlini PR c++/61614 * g++.dg/ext/complit14.C: New. From-SVN: r212073 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/semantics.c | 1 - gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/ext/complit14.C | 11 +++++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/ext/complit14.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e8aee0f..90ec8ad 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2014-06-27 Paolo Carlini + PR c++/61614 + * semantics.c (finish_compound_literal): Revert r204228. + +2014-06-27 Paolo Carlini + * parser.c (cp_parser_compound_literal_p): New. (cp_parser_postfix_expression, cp_parser_sizeof_operand): Use it. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 241884c..456df7b 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 04d08b5..979f2e6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-06-27 Paolo Carlini + + PR c++/61614 + * g++.dg/ext/complit14.C: New. + 2014-06-27 Martin Jambor PR ipa/61160 diff --git a/gcc/testsuite/g++.dg/ext/complit14.C b/gcc/testsuite/g++.dg/ext/complit14.C new file mode 100644 index 0000000..aed765d --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/complit14.C @@ -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 +} -- 2.7.4