On 04/07/2014 12:56 PM, Dinar Temirbulatov wrote:
/* We can't initialize a register from a AGGR_INIT_EXPR. */ else if (! cfun->returns_struct && TREE_CODE (retval) == TARGET_EXPR && TREE_CODE (TREE_OPERAND (retval, 1)) == AGGR_INIT_EXPR) retval = build2 (COMPOUND_EXPR, TREE_TYPE (retval), retval, TREE_OPERAND (retval, 0));
That code is extremely ancient. I agree that it seems kind of useless, but the fact that we're hitting it indicates a bug: cfun->returns_struct should have been set by apply_deduced_return_type. I guess we need to call complete_type before aggregate_value_p. Let's fix that now, and then remove this chunk of code after 4.9 branches.
+++ b/gcc/testsuite/g++.dg/cpp1y/pr57958.C
The cpp1y directory is for C++14 tests; C++11 tests should go in cpp0x. Perhaps we should rename the directories. :)
+// { dg-options -std=c++11 } +// { dg-do run }
Please use { dg-do run { target c++11 } } rather than specify -std in dg-options.
Jason