This is the mail archive of the gcc-cvs@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]

r278119 - in /trunk/gcc: cp/ChangeLog cp/cp-tre...


Author: rsandifo
Date: Wed Nov 13 08:42:56 2019
New Revision: 278119

URL: https://gcc.gnu.org/viewcvs?rev=278119&root=gcc&view=rev
Log:
[C++] Fix interaction between aka changes and DR1558 (PR92206)

One of the changes in r277281 was to make the typedef variant
handling in strip_typedefs pass the raw DECL_ORIGINAL_TYPE to the
recursive call, instead of applying TYPE_MAIN_VARIANT first.
This PR shows that that interacts badly with the implementation
of DR1558, because we then refuse to strip aliases with dependent
template parameters and trip:

  gcc_assert (!typedef_variant_p (result)
	      || ((flags & STF_USER_VISIBLE)
		  && !user_facing_original_type_p (result)));

Keeping the current behaviour but suppressing the ICE leads to a
duplicate error (the dg-bogus in the first test), so that didn't
seem like a good fix.

I assume keeping the alias should never actually be necessary for
DECL_ORIGINAL_TYPEs, because it will already have been checked
somewhere, even for implicit TYPE_DECLs.  This patch therefore
passes a flag to say that we can safely strip aliases with
dependent template parameters.

2019-11-13  Richard Sandiford  <richard.sandiford@arm.com>

gcc/cp/
	PR c++/92206
	* cp-tree.h (STF_STRIP_DEPENDENT): New constant.
	* tree.c (strip_typedefs): Add STF_STRIP_DEPENDENT to the flags
	when calling strip_typedefs recursively on a DECL_ORIGINAL_TYPE.
	Don't apply the fix for DR1558 in that case; allow aliases with
	dependent template parameters to be stripped instead.

gcc/testsuite/
	PR c++/92206
	* g++.dg/cpp0x/alias-decl-pr92206-1.C: New test.
	* g++.dg/cpp0x/alias-decl-pr92206-2.C: Likewise.
	* g++.dg/cpp0x/alias-decl-pr92206-3.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/alias-decl-pr92206-1.C
    trunk/gcc/testsuite/g++.dg/cpp0x/alias-decl-pr92206-2.C
    trunk/gcc/testsuite/g++.dg/cpp0x/alias-decl-pr92206-3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/tree.c
    trunk/gcc/testsuite/ChangeLog


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