public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114889] New: [modules] ICE in friend_accessible_p with imported class template specialization befriending class template
@ 2024-04-29 13:15 ppalka at gcc dot gnu.org
2024-04-29 13:17 ` [Bug c++/114889] " ppalka at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-04-29 13:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114889
Bug ID: 114889
Summary: [modules] ICE in friend_accessible_p with imported
class template specialization befriending class
template
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ppalka at gcc dot gnu.org
Target Milestone: ---
$ cat testcase_a.C
export module mymod;
template <typename, typename>
struct _Hashtable;
export
template <typename _Key, typename _Val>
struct _Map_base {
void f() {
_Hashtable<_Key, _Val> __h;
__h._M_hash_code(0);
}
};
template <typename _Key, typename _Value>
struct _Hashtable {
template <typename, typename> friend struct _Map_base;
protected:
void _M_hash_code(int);
};
_Hashtable<int, int> m;
$ cat testcase_b.C
import mymod;
int main() {
_Map_base<int, int> m;
m.f();
}
$ g++ -fmodules-ts testcase_*
In module mymod, imported at testcase_b.C:1:
testcase_a.C: In instantiation of ‘void _Map_base@mymod<_Key, _Val>::f() [with
_Key = int; _Val = int]’:
testcase_b.C:5:6: required from here
5 | m.f();
| ~~~^~
testcase_a.C:11:21: internal compiler error: in friend_accessible_p, at
cp/search.cc:803
11 | __h._M_hash_code(0);
| ~~~~~~~~~~~~~~~~^~~
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114889] [modules] ICE in friend_accessible_p with imported class template specialization befriending class template
2024-04-29 13:15 [Bug c++/114889] New: [modules] ICE in friend_accessible_p with imported class template specialization befriending class template ppalka at gcc dot gnu.org
@ 2024-04-29 13:17 ` ppalka at gcc dot gnu.org
2024-04-30 1:28 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-04-29 13:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114889
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Blocks| |103524
Ever confirmed|0 |1
Keywords| |ice-checking, rejects-valid
Last reconfirmed| |2024-04-29
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103524
[Bug 103524] [meta-bug] modules issue
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114889] [modules] ICE in friend_accessible_p with imported class template specialization befriending class template
2024-04-29 13:15 [Bug c++/114889] New: [modules] ICE in friend_accessible_p with imported class template specialization befriending class template ppalka at gcc dot gnu.org
2024-04-29 13:17 ` [Bug c++/114889] " ppalka at gcc dot gnu.org
@ 2024-04-30 1:28 ` cvs-commit at gcc dot gnu.org
2024-04-30 1:29 ` ppalka at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-30 1:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114889
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:22b20ac6c6aead2d3f36c413a77dd0b80adfec39
commit r15-57-g22b20ac6c6aead2d3f36c413a77dd0b80adfec39
Author: Patrick Palka <ppalka@redhat.com>
Date: Mon Apr 29 21:27:59 2024 -0400
c++/modules: imported spec befriending class tmpl [PR114889]
When adding to CLASSTYPE_BEFRIENDING_CLASSES as part of installing an
imported class definition, we need to look through TEMPLATE_DECL like
make_friend_class does.
Otherwise in the below testcase we won't add _Hashtable<int, int> to
CLASSTYPE_BEFRIENDING_CLASSES of _Map_base, which leads to a bogus
access check failure for _M_hash_code.
PR c++/114889
gcc/cp/ChangeLog:
* module.cc (trees_in::read_class_def): Look through
TEMPLATE_DECL when adding to CLASSTYPE_BEFRIENDING_CLASSES.
gcc/testsuite/ChangeLog:
* g++.dg/modules/friend-8_a.H: New test.
* g++.dg/modules/friend-8_b.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114889] [modules] ICE in friend_accessible_p with imported class template specialization befriending class template
2024-04-29 13:15 [Bug c++/114889] New: [modules] ICE in friend_accessible_p with imported class template specialization befriending class template ppalka at gcc dot gnu.org
2024-04-29 13:17 ` [Bug c++/114889] " ppalka at gcc dot gnu.org
2024-04-30 1:28 ` cvs-commit at gcc dot gnu.org
@ 2024-04-30 1:29 ` ppalka at gcc dot gnu.org
2024-05-07 14:49 ` cvs-commit at gcc dot gnu.org
2024-05-07 14:49 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-04-30 1:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114889
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114889] [modules] ICE in friend_accessible_p with imported class template specialization befriending class template
2024-04-29 13:15 [Bug c++/114889] New: [modules] ICE in friend_accessible_p with imported class template specialization befriending class template ppalka at gcc dot gnu.org
` (2 preceding siblings ...)
2024-04-30 1:29 ` ppalka at gcc dot gnu.org
@ 2024-05-07 14:49 ` cvs-commit at gcc dot gnu.org
2024-05-07 14:49 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-07 14:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114889
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:390bd23fd9c98dc40856beef05364f5d1c7b9d04
commit r14-10176-g390bd23fd9c98dc40856beef05364f5d1c7b9d04
Author: Patrick Palka <ppalka@redhat.com>
Date: Mon Apr 29 21:27:59 2024 -0400
c++/modules: imported spec befriending class tmpl [PR114889]
When adding to CLASSTYPE_BEFRIENDING_CLASSES as part of installing an
imported class definition, we need to look through TEMPLATE_DECL like
make_friend_class does.
Otherwise in the below testcase we won't add _Hashtable<int, int> to
CLASSTYPE_BEFRIENDING_CLASSES of _Map_base, which leads to a bogus
access check failure for _M_hash_code.
PR c++/114889
gcc/cp/ChangeLog:
* module.cc (trees_in::read_class_def): Look through
TEMPLATE_DECL when adding to CLASSTYPE_BEFRIENDING_CLASSES.
gcc/testsuite/ChangeLog:
* g++.dg/modules/friend-8_a.H: New test.
* g++.dg/modules/friend-8_b.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit 22b20ac6c6aead2d3f36c413a77dd0b80adfec39)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/114889] [modules] ICE in friend_accessible_p with imported class template specialization befriending class template
2024-04-29 13:15 [Bug c++/114889] New: [modules] ICE in friend_accessible_p with imported class template specialization befriending class template ppalka at gcc dot gnu.org
` (3 preceding siblings ...)
2024-05-07 14:49 ` cvs-commit at gcc dot gnu.org
@ 2024-05-07 14:49 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-05-07 14:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114889
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 14.2
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-05-07 14:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-29 13:15 [Bug c++/114889] New: [modules] ICE in friend_accessible_p with imported class template specialization befriending class template ppalka at gcc dot gnu.org
2024-04-29 13:17 ` [Bug c++/114889] " ppalka at gcc dot gnu.org
2024-04-30 1:28 ` cvs-commit at gcc dot gnu.org
2024-04-30 1:29 ` ppalka at gcc dot gnu.org
2024-05-07 14:49 ` cvs-commit at gcc dot gnu.org
2024-05-07 14:49 ` ppalka at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).