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: [PATCH] Fix PR c++/70332 (ICE due to aggregate initialization of NSDMI)


On 03/22/2016 07:12 PM, Patrick Palka wrote:
On Tue, Mar 22, 2016 at 6:12 PM, Patrick Palka <patrick@parcs.ath.cx> wrote:
On Tue, Mar 22, 2016 at 6:00 PM, Jason Merrill <jason@redhat.com> wrote:
On 03/22/2016 05:35 PM, Patrick Palka wrote:

+             if (cp_unevaluated_operand == 0


Why check this here?

Just so that the change doesn't affect the behavior of tsubst_decl()
when cp_unevaluated_operand != 0.  Presumably the existing code (10
lines below) handles that case just fine.

Turns out that without the check we can trigger the cxx_dialect >=
cxx14 assert because in c++11 mode we can reach the assert through
get_defaulted_eh_spec() which increments cp_unevaluated_operand and
then calls get_nsdmi (..., /*in_ctor=*/false) causing
current_class_ref to get set to a PLACEHOLDER_EXPR.

So for example g++.dg/cpp0x/nsdmi-template2.C regresses with an ICE.
So it seems the cp_unevaluated_operand != 0 check is necessary as long
as the assert stays.

There are no regressions if both the cp_unevaluated_operand check and
the assert are removed however.

I think that's my preference.

Jason



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