public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/115616] New: Friend-injecting a template function causes an ICE if you inject after trying to instantiate that function @ 2024-06-24 13:19 iamsupermouse at mail dot ru 2024-06-25 20:39 ` [Bug c++/115616] c++20: " mpolacek at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: iamsupermouse at mail dot ru @ 2024-06-24 13:19 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115616 Bug ID: 115616 Summary: Friend-injecting a template function causes an ICE if you inject after trying to instantiate that function Product: gcc Version: 14.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: iamsupermouse at mail dot ru Target Milestone: --- The following causes an internal compiler error in GCC 14 and trunk: https://gcc.godbolt.org/z/z9PWhWvzh Same bug in Clang: https://github.com/llvm/llvm-project/issues/96485 MSVC compiles this successfully and calls `bar<10,20>()`. template <int X, int Y> void bar() {} template <typename T> struct Reader { template <int X> friend void foo(Reader<T>); }; template <typename T, int Y> struct Writer { template <int X> friend void foo(Reader<T>) {bar<X, Y>();} }; int main() { foo<10>(Reader<int>{}); Writer<int, 20>{}; } GCC says: (this is trunk, v14 just says "segmentation fault") <source>: In instantiation of 'void foo(Reader<T>) [with int X = 10; T = int; int Y = <missing>]': <source>:19:12: required from here 19 | foo<10>(Reader<int>{}); | ~~~~~~~^~~~~~~~~~~~~~~ <source>:14:33: internal compiler error: tree check: accessed elt 2 of 'tree_vec' with 1 elts in tsubst, at cp/pt.cc:16362 14 | friend void foo(Reader<T>) {bar<X, Y>();} | ^~~~~~~~~ 0x26cfe8c internal_error(char const*, ...) ???:0 0x97a4bb tree_vec_elt_check_failed(int, int, char const*, int, char const*) ???:0 0xcbc689 tsubst_template_args(tree_node*, tree_node*, int, tree_node*) ???:0 0xcabce3 instantiate_decl(tree_node*, bool, bool) ???:0 0xcd625b instantiate_pending_templates(int) ???:0 0xb6e830 c_parse_final_cleanups() ???:0 0xdcad68 c_common_parse_file() ???:0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/115616] c++20: Friend-injecting a template function causes an ICE if you inject after trying to instantiate that function 2024-06-24 13:19 [Bug c++/115616] New: Friend-injecting a template function causes an ICE if you inject after trying to instantiate that function iamsupermouse at mail dot ru @ 2024-06-25 20:39 ` mpolacek at gcc dot gnu.org 2024-08-30 20:35 ` cvs-commit at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: mpolacek at gcc dot gnu.org @ 2024-06-25 20:39 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115616 Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org Ever confirmed|0 |1 Last reconfirmed| |2024-06-25 Status|UNCONFIRMED |ASSIGNED CC| |mpolacek at gcc dot gnu.org --- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Started with r9-3807-g5d9a0e3b99e31a commit 5d9a0e3b99e31a2167f6b6ab2473feb58f7c77e8 Author: Marek Polacek <polacek@redhat.com> Date: Thu Nov 1 22:10:31 2018 +0000 Implement P0846R0, ADL and function templates. so apparently mine. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/115616] c++20: Friend-injecting a template function causes an ICE if you inject after trying to instantiate that function 2024-06-24 13:19 [Bug c++/115616] New: Friend-injecting a template function causes an ICE if you inject after trying to instantiate that function iamsupermouse at mail dot ru 2024-06-25 20:39 ` [Bug c++/115616] c++20: " mpolacek at gcc dot gnu.org @ 2024-08-30 20:35 ` cvs-commit at gcc dot gnu.org 2024-08-30 20:35 ` mpolacek at gcc dot gnu.org 2024-09-04 17:07 ` ppalka at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2024-08-30 20:35 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115616 --- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>: https://gcc.gnu.org/g:ffd56dcc11e32033a1f3a964af584dc32321a125 commit r15-3325-gffd56dcc11e32033a1f3a964af584dc32321a125 Author: Marek Polacek <polacek@redhat.com> Date: Fri Aug 30 16:34:11 2024 -0400 c++: add fixed test [PR115616] This got fixed by r15-2120. PR c++/115616 gcc/testsuite/ChangeLog: * g++.dg/template/friend83.C: New test. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/115616] c++20: Friend-injecting a template function causes an ICE if you inject after trying to instantiate that function 2024-06-24 13:19 [Bug c++/115616] New: Friend-injecting a template function causes an ICE if you inject after trying to instantiate that function iamsupermouse at mail dot ru 2024-06-25 20:39 ` [Bug c++/115616] c++20: " mpolacek at gcc dot gnu.org 2024-08-30 20:35 ` cvs-commit at gcc dot gnu.org @ 2024-08-30 20:35 ` mpolacek at gcc dot gnu.org 2024-09-04 17:07 ` ppalka at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: mpolacek at gcc dot gnu.org @ 2024-08-30 20:35 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115616 Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|ASSIGNED |RESOLVED --- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Fixed by r15-2120. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/115616] c++20: Friend-injecting a template function causes an ICE if you inject after trying to instantiate that function 2024-06-24 13:19 [Bug c++/115616] New: Friend-injecting a template function causes an ICE if you inject after trying to instantiate that function iamsupermouse at mail dot ru ` (2 preceding siblings ...) 2024-08-30 20:35 ` mpolacek at gcc dot gnu.org @ 2024-09-04 17:07 ` ppalka at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: ppalka at gcc dot gnu.org @ 2024-09-04 17:07 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115616 Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|FIXED |DUPLICATE See Also|https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=112288 | --- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> --- Let's mark this a dup of PR112288 since the fix got backported *** This bug has been marked as a duplicate of bug 112288 *** ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-09-04 17:07 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-06-24 13:19 [Bug c++/115616] New: Friend-injecting a template function causes an ICE if you inject after trying to instantiate that function iamsupermouse at mail dot ru 2024-06-25 20:39 ` [Bug c++/115616] c++20: " mpolacek at gcc dot gnu.org 2024-08-30 20:35 ` cvs-commit at gcc dot gnu.org 2024-08-30 20:35 ` mpolacek at gcc dot gnu.org 2024-09-04 17:07 ` 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).