Hi,
r204228 represented just a small cleanup
(https://gcc.gnu.org/ml/gcc-patches/2013-10/msg02597.html) but
apparently is causing this small regression present on the release
branch too. Shall we simply revert it for now? At least on the branch?
Tested x86_64-linux.
Thanks,
Paolo.
/////////////
/cp
2014-06-27 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/61614
* semantics.c (finish_compound_literal): Revert r204228.
/testsuite
2014-06-27 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/61614
* g++.dg/ext/complit14.C: New.
Index: cp/semantics.c
===================================================================
--- cp/semantics.c (revision 212064)
+++ cp/semantics.c (working copy)
@@ -2607,7 +2607,6 @@ finish_compound_literal (tree type, tree compound_
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: testsuite/g++.dg/ext/complit14.C
===================================================================
--- testsuite/g++.dg/ext/complit14.C (revision 0)
+++ testsuite/g++.dg/ext/complit14.C (working copy)
@@ -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
+}