[Bug c++/92206] [10 Regression] ICE in strip_typedefs, at cp/tree.c:1682 since r277281

2019-12-05 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92206

--- Comment #13 from Marek Polacek  ---
*** Bug 92441 has been marked as a duplicate of this bug. ***

[Bug c++/92206] [10 Regression] ICE in strip_typedefs, at cp/tree.c:1682 since r277281

2019-11-27 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92206

--- Comment #12 from Jason Merrill  ---
Author: jason
Date: Wed Nov 27 22:05:41 2019
New Revision: 278784

URL: https://gcc.gnu.org/viewcvs?rev=278784=gcc=rev
Log:
PR c++/92206 - ICE with typedef to dependent alias.

rsandifo's patch for 92206 demonstrated a problem with the existing checking
for alias template specializations: they were returning false for a typedef
to an alias template specialization.  Which is sometimes what the caller
wants, and sometimes not: Sometimes we're interested in whether the type was
written as an alias template-id, and sometimes whether it represents one.

The testcase illustrates a case that remained wrong with the earlier patch:
if the typedef is itself an alias template specialization, we can't strip an
underlying dependent alias.

* pt.c (dependent_alias_template_spec_p)
(alias_template_specialization_p): Add transparent_typedefs
parameter.
(iterative_hash_template_arg, any_template_parm_r)
(primary_template_specialization_p, tsubst, dependent_type_p_r):
Adjust.
* decl.c (check_elaborated_type_specifier): Adjust.
* error.c (dump_template_bindings, dump_aggr_type): Adjust.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/alias-decl-pr92206-4.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/decl.c
trunk/gcc/cp/error.c
trunk/gcc/cp/pt.c
trunk/gcc/cp/tree.c
trunk/gcc/cp/typeck.c

[Bug c++/92206] [10 Regression] ICE in strip_typedefs, at cp/tree.c:1682 since r277281

2019-11-13 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92206

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #11 from rsandifo at gcc dot gnu.org  
---
Fixed.

[Bug c++/92206] [10 Regression] ICE in strip_typedefs, at cp/tree.c:1682 since r277281

2019-11-13 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92206

--- Comment #10 from rsandifo at gcc dot gnu.org  
---
Author: rsandifo
Date: Wed Nov 13 08:42:56 2019
New Revision: 278119

URL: https://gcc.gnu.org/viewcvs?rev=278119=gcc=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  

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

[Bug c++/92206] [10 Regression] ICE in strip_typedefs, at cp/tree.c:1682 since r277281

2019-10-31 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92206

Marek Polacek  changed:

   What|Removed |Added

 CC||TonyELewis at hotmail dot com

--- Comment #9 from Marek Polacek  ---
*** Bug 92313 has been marked as a duplicate of this bug. ***

[Bug c++/92206] [10 Regression] ICE in strip_typedefs, at cp/tree.c:1682 since r277281

2019-10-30 Thread gcc-bugs at marehr dot dialup.fu-berlin.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92206

--- Comment #8 from gcc-bugs at marehr dot dialup.fu-berlin.de ---
Thank you! I can confirm that the patch resolved the issue.

[Bug c++/92206] [10 Regression] ICE in strip_typedefs, at cp/tree.c:1682 since r277281

2019-10-30 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92206

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

URL||https://gcc.gnu.org/ml/gcc-
   ||patches/2019-10/msg01839.ht
   ||ml

--- Comment #7 from rsandifo at gcc dot gnu.org  
---
I posted a patch last week but just realised I forgot to link to it here.
https://gcc.gnu.org/ml/gcc-patches/2019-10/msg01839.html

[Bug c++/92206] [10 Regression] ICE in strip_typedefs, at cp/tree.c:1682 since r277281

2019-10-30 Thread gcc-bugs at marehr dot dialup.fu-berlin.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92206

gcc-bugs at marehr dot dialup.fu-berlin.de changed:

   What|Removed |Added

 CC||gcc-bugs at marehr dot 
dialup.fu-b
   ||erlin.de

--- Comment #6 from gcc-bugs at marehr dot dialup.fu-berlin.de ---
```c++

#include 

template  struct is_swappable_with;

template )>
using iter_reference_t_ = R;

template  using iter_reference_t = iter_reference_t_;
template 
std::enable_if_t<
is_swappable_with, iter_reference_t>::value>
operator00;

```

Another one, reduced from range-v3.

[Bug c++/92206] [10 Regression] ICE in strip_typedefs, at cp/tree.c:1682 since r277281

2019-10-29 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92206

--- Comment #5 from Jeffrey A. Law  ---
Just to pile on here.  It affects icecat as well.

[Bug c++/92206] [10 Regression] ICE in strip_typedefs, at cp/tree.c:1682 since r277281

2019-10-25 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92206

David Binderman  changed:

   What|Removed |Added

 CC||dcb314 at hotmail dot com

--- Comment #4 from David Binderman  ---
I also see this problem, when compiling package range-v3 in fedora.

[Bug c++/92206] [10 Regression] ICE in strip_typedefs, at cp/tree.c:1682 since r277281

2019-10-24 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92206

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |rsandifo at gcc dot 
gnu.org

--- Comment #3 from rsandifo at gcc dot gnu.org  
---
Mine.

[Bug c++/92206] [10 Regression] ICE in strip_typedefs, at cp/tree.c:1682 since r277281

2019-10-24 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92206

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek  ---
Found this ICE too, my test:

template  void a();
template  struct b;
template  using c = int;
template )> using f = e;
template  using g = f;
template  c>::i> j;

[Bug c++/92206] [10 Regression] ICE in strip_typedefs, at cp/tree.c:1682 since r277281

2019-10-24 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92206

--- Comment #1 from Martin Liška  ---
Reduced test-case:

$ cat unified.ii
template  struct A;
class Vector {
  template  struct TypeIsGCThing {
template ::Type> using Vector = Vector;
struct B;
template  class ContainerIter {
  using Action = B;
  using ActionVector = Vector;
  ContainerIter a;
};
  };
};

$ g++ unified.ii -c
unified.ii:9:33: internal compiler error: in strip_typedefs, at cp/tree.c:1682
9 |   ContainerIter a;
  | ^
0x5c5ba0 strip_typedefs(tree_node*, bool*, unsigned int)
../../gcc/cp/tree.c:1682
0x5c5ba0 strip_typedefs(tree_node*, bool*, unsigned int)
../../gcc/cp/tree.c:1462
0x6f4311 canonicalize_type_argument
../../gcc/cp/pt.c:7928
0x6f4311 canonicalize_type_argument
../../gcc/cp/pt.c:7923
0x70734d coerce_template_parms
../../gcc/cp/pt.c:8771
0x7080df coerce_innermost_template_parms
../../gcc/cp/pt.c:8903
0x71842a lookup_template_class_1
../../gcc/cp/pt.c:9608
0x71842a lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
../../gcc/cp/pt.c:9978
0x730e0d finish_template_type(tree_node*, tree_node*, int)
../../gcc/cp/semantics.c:3396
0x6e28fd cp_parser_template_id
../../gcc/cp/parser.c:16545
0x6e2af7 cp_parser_class_name
../../gcc/cp/parser.c:23416
0x6df890 cp_parser_qualifying_entity
../../gcc/cp/parser.c:6724
0x6df890 cp_parser_nested_name_specifier_opt
../../gcc/cp/parser.c:6408
0x6dfe92 cp_parser_nested_name_specifier
../../gcc/cp/parser.c:6650
0x6e489a cp_parser_using_declaration
../../gcc/cp/parser.c:19603
0x6ef7bc cp_parser_member_declaration
../../gcc/cp/parser.c:24632
0x6cc220 cp_parser_member_specification_opt
../../gcc/cp/parser.c:24492
0x6cc220 cp_parser_class_specifier_1
../../gcc/cp/parser.c:23592
0x6cdc00 cp_parser_class_specifier
../../gcc/cp/parser.c:23899
0x6cdc00 cp_parser_type_specifier
../../gcc/cp/parser.c:17507

[Bug c++/92206] [10 Regression] ICE in strip_typedefs, at cp/tree.c:1682 since r277281

2019-10-24 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92206

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-10-24
 CC||rsandifo at gcc dot gnu.org
  Known to work||9.2.0
   Target Milestone|--- |10.0
 Ever confirmed|0   |1
  Known to fail||10.0