This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch/RFC] PR 70572 ("[4.9/5/6/7 Regression] ICE on code with decltype (auto) on x86_64-linux-gnu in digest_init_r")


On 05/18/2016 11:48 AM, Paolo Carlini wrote:
Hi,

this issue should be easy to fix. Broken code like:

void foo ()
{
  decltype (auto) a = foo;
}

triggers the gcc_assert in digest_init_r:

  /* Come here only for aggregates: records, arrays, unions, complex
numbers
     and vectors.  */
  gcc_assert (TREE_CODE (type) == ARRAY_TYPE
          || VECTOR_TYPE_P (type)
          || TREE_CODE (type) == RECORD_TYPE
          || TREE_CODE (type) == UNION_TYPE
          || TREE_CODE (type) == COMPLEX_TYPE);

because of course TREE_CODE (type) == FUNCTION_TYPE, none of the above.
I said should be easy to fix because in fact convert_for_initialization
is perfectly able to handle these cases and emit proper diagnostic, if
called. What shall we do then? The patchlet below passes testing but we
could also relax the gcc_assert itself, include FUNCTION_TYPE
with/without checking cxx_dialect >= cxx14. We could drop the latter
check in my patchlet. Or something else entirely.

Thanks!
Paolo.

////////////////////////

Shouldn't we have complained about declaring a variable with function type before we get here?

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]