[Bug c++/99285] [modules] ICE canonical types differ for identical types ‘std::common_type...

2021-03-08 Thread nathan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99285

Nathan Sidwell  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Nathan Sidwell  ---
ded6a1953dd 2021-03-08 | c++: Incorrect specialization hash table [PR 99285]

[Bug c++/99285] [modules] ICE canonical types differ for identical types ‘std::common_type...

2021-03-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99285

--- Comment #2 from CVS Commits  ---
The master branch has been updated by Nathan Sidwell :

https://gcc.gnu.org/g:ded6a1953dd7f43229c44e5d0d17c264338a3f4c

commit r11-7557-gded6a1953dd7f43229c44e5d0d17c264338a3f4c
Author: Nathan Sidwell 
Date:   Mon Mar 8 10:01:21 2021 -0800

c++: Incorrect specialization hash table [PR 99285]

Class template partial specializations need to be in the
specialization hash, but not all of them.  This defers adding
streamed-in entities to the hash table, in the same way I deferred
adding the instantiation and specialization lists for 99170.

PR c++/99285
gcc/cp/
* cp-tree.h (match_mergeable_specialization)
(add_mergeable_specialization): Adjust parms.
* module.cc (trees_in::decl_value): Adjust
add_mergeable_specialization calls.
(trees_out::key_mergeable): Adjust match_mergeable_specialization
calls.
(specialization_add): Likewise.
* pt.c (match_mergeable_specialization): Do not insert.
(add_mergeable_specialization): Add to hash table here.
gcc/testsuite/
* g++.dg/modules/pr99285_a.H: New.
* g++.dg/modules/pr99285_b.H: New.

[Bug c++/99285] [modules] ICE canonical types differ for identical types ‘std::common_type...

2021-03-05 Thread nathan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99285

--- Comment #1 from Nathan Sidwell  ---
//bug_a.ii
template struct common_type;

template<> struct common_type<> {};

template struct common_type<_Tp0> {};

template struct common_type<_Tp1, _Tp2> {};

//bug_b.ii
import  "bug_a.ii";

template::type>
struct X;

./cc1plus -quiet -std=c++20 -fmodule-header bug_a.ii && ./cc1plus -quiet
-std=c++20 -fmodule-header bug_b.ii  
bug_b.ii:4:60: internal compiler error: canonical types differ for identical
types 'common_type<_Rep1, _Rep2>' and 'common_type<_Tp1, _Tp2>'
4 |  typename _CRep = typename common_type<_Rep1, _Rep2>::type>
  |^
0xea4ed7 comptypes(tree_node*, tree_node*, int)
../../../src/gcc/cp/typeck.c:1547
0xe4beea fixup_template_type
../../../src/gcc/cp/semantics.c:3477
0xe4c1f6 finish_template_type(tree_node*, tree_node*, int)
../../../src/gcc/cp/semantics.c:3510
0xd4aa7b cp_parser_template_id
../../../src/gcc/cp/parser.c:17444
0xd59426 cp_parser_class_name
../../../src/gcc/cp/parser.c:24671
0xd34ebf cp_parser_qualifying_entity
../../../src/gcc/cp/parser.c:6994