re PR c++/61614 (Bogus error: taking address of temporary array)
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 27 Jun 2014 14:04:28 +0000 (14:04 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 27 Jun 2014 14:04:28 +0000 (14:04 +0000)
/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

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/complit14.C [new file with mode: 0644]

index e8aee0f992729a51a6332c50f21a80bfa37f099c..90ec8ad008bee24998b058e490b47dc2b4fba89c 100644 (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.
index 241884cfffec944160535736772d2f694b39a229..456df7b1bd8d3a2dd06a2d43f91e6e8e0ac2ac94 100644 (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);
index 04d08b5a034cc3df46034f01fab920501a76685b..979f2e6b290c463c0d696d034e924bb5b6b5ed2e 100644 (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
diff --git a/gcc/testsuite/g++.dg/ext/complit14.C b/gcc/testsuite/g++.dg/ext/complit14.C
new file mode 100644 (file)
index 0000000..aed765d
--- /dev/null
@@ -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
+}