]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++/modules: ICEs with modular fmtlib
authorPatrick Palka <ppalka@redhat.com>
Tue, 13 Feb 2024 19:26:40 +0000 (14:26 -0500)
committerPatrick Palka <ppalka@redhat.com>
Tue, 13 Feb 2024 19:26:40 +0000 (14:26 -0500)
commitcb76d7e47693364861e63ea3bb274b1b5295a943
tree9b8e802c807ae2491b5bd68dfd338ea1fad73b09
parentce67b75e918bcbd31ed32bc820f5233c72670feb
c++/modules: ICEs with modular fmtlib

Building modular fmtlib triggered two small modules bugs in C++23 and
C++26 mode respectively (due to libstdc++ header differences).

The first is that a TEMPLATE_DECL having DECL_LANG_SPECIFIC doesn't
necessarily imply that its DECL_TEMPLATE_RESULT has DECL_LANG_SPECIFIC.
So in add_specializations we need to use STRIP_TEMPLATE consistently;
this is a follow-up to r12-7187-gdb84f382ae3dc2.

The second is that get_originating_module_decl was ICEing on class-scope
enumerators injected via using-enum.  I suppose we should handle them
like a class-scope entity rather than a non-using-enum enumerator.

gcc/cp/ChangeLog:

* module.cc (depset::hash::add_specializations): Use
STRIP_TEMPLATE consistently.
(get_originating_module_decl): Handle class-scope CONST_DECL.

gcc/testsuite/ChangeLog:

* g++.dg/modules/friend-6_a.C: New test.
* g++.dg/modules/using-enum-3_a.C: New test.
* g++.dg/modules/using-enum-3_b.C: New test.

Reviewed-by: Jason Merill <jason@redhat.com>
gcc/cp/module.cc
gcc/testsuite/g++.dg/modules/friend-6_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/using-enum-3_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/using-enum-3_b.C [new file with mode: 0644]