public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111890] New: ICE in build_new_op, friend operator in nested template specialization with constrained return type
@ 2023-10-20  8:02 kcayimckaghxtnkrvg at cwmxc dot com
  2023-10-22 19:13 ` [Bug c++/111890] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: kcayimckaghxtnkrvg at cwmxc dot com @ 2023-10-20  8:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111890

            Bug ID: 111890
           Summary: ICE in build_new_op, friend operator in nested
                    template specialization with constrained return type
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kcayimckaghxtnkrvg at cwmxc dot com
  Target Milestone: ---

I have encountered ICE when writing this demo code:
https://godbolt.org/z/qTsPh5PbW
I don't have shorter repro case, sorry. The code compiles fine with clang.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/111890] ICE in build_new_op, friend operator in nested template specialization with constrained return type
  2023-10-20  8:02 [Bug c++/111890] New: ICE in build_new_op, friend operator in nested template specialization with constrained return type kcayimckaghxtnkrvg at cwmxc dot com
@ 2023-10-22 19:13 ` pinskia at gcc dot gnu.org
  2023-10-22 20:40 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-22 19:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111890

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 56170
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56170&action=edit
testcase

Next time please attach or put inline the testcase rather than linking to
godbolt.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/111890] ICE in build_new_op, friend operator in nested template specialization with constrained return type
  2023-10-20  8:02 [Bug c++/111890] New: ICE in build_new_op, friend operator in nested template specialization with constrained return type kcayimckaghxtnkrvg at cwmxc dot com
  2023-10-22 19:13 ` [Bug c++/111890] " pinskia at gcc dot gnu.org
@ 2023-10-22 20:40 ` pinskia at gcc dot gnu.org
  2023-10-22 21:27 ` [Bug c++/111890] ICE in build_new_op with friend function declared inside a concept constrainted class inside a template class pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-22 20:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111890

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 56171
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56171&action=edit
Reduced somewhat

Still requires the include though.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/111890] ICE in build_new_op with friend function declared inside a concept constrainted class inside a template class
  2023-10-20  8:02 [Bug c++/111890] New: ICE in build_new_op, friend operator in nested template specialization with constrained return type kcayimckaghxtnkrvg at cwmxc dot com
  2023-10-22 19:13 ` [Bug c++/111890] " pinskia at gcc dot gnu.org
  2023-10-22 20:40 ` pinskia at gcc dot gnu.org
@ 2023-10-22 21:27 ` pinskia at gcc dot gnu.org
  2023-10-22 21:30 ` [Bug c++/111890] ICE in tsubst_friend_function " pinskia at gcc dot gnu.org
  2023-10-23 22:38 ` sjames at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-22 21:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111890

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-10-22
            Summary|ICE in build_new_op, friend |ICE in build_new_op with
                   |operator in nested template |friend function declared
                   |specialization with         |inside a concept
                   |constrained return type     |constrainted class inside a
                   |                            |template class

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase without any includes or any magic functions:
```
template <typename> concept t = true;
template <typename> concept f = false;
template <int> struct TakeView {
  template <typename T> class Iterator {};
  template <f T> class Iterator<T> {};
  template <t T> struct Iterator<T> {
    friend  auto operator+(const Iterator &it, int) {}
  };
};
TakeView<1>::Iterator<float> tt;
```

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/111890] ICE in tsubst_friend_function with friend function declared inside a concept constrainted class inside a template class
  2023-10-20  8:02 [Bug c++/111890] New: ICE in build_new_op, friend operator in nested template specialization with constrained return type kcayimckaghxtnkrvg at cwmxc dot com
                   ` (2 preceding siblings ...)
  2023-10-22 21:27 ` [Bug c++/111890] ICE in build_new_op with friend function declared inside a concept constrainted class inside a template class pinskia at gcc dot gnu.org
@ 2023-10-22 21:30 ` pinskia at gcc dot gnu.org
  2023-10-23 22:38 ` sjames at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-22 21:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111890

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Full backtrace:
```
t1.cc:8:18: internal compiler error: Segmentation fault
    8 |     friend  auto operator+(const Iterator &it, int) {}
      |                  ^~~~~~~~
0x12dabdf crash_signal
        /home/apinski/src/upstream-gcc-git/gcc/gcc/toplev.cc:314
0x7f6489454def ???
       
/usr/src/debug/glibc-2.34-60.el9.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0xc4156c tree_check(tree_node*, char const*, int, char const*, tree_code)
        /home/apinski/src/upstream-gcc-git/gcc/gcc/tree.h:3595
0xc4156c tsubst_friend_function
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/pt.cc:11351
0xc42536 instantiate_class_template(tree_node*)
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/pt.cc:12543
0xc95550 complete_type(tree_node*)
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/typeck.cc:138
0xaaee4b start_decl_1(tree_node*, bool)
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/decl.cc:6009
0xaaee4b start_decl_1(tree_node*, bool)
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/decl.cc:5988
0xacee2f start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/decl.cc:5975
0xbda5c5 cp_parser_init_declarator
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:23135
0xbaddd8 cp_parser_simple_declaration
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:15621
0xbe5b71 cp_parser_declaration
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:15307
0xbe6a42 cp_parser_toplevel_declaration
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:15328
0xbe6a42 cp_parser_translation_unit
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:5192
0xbe6a42 c_parse_file()
        /home/apinski/src/upstream-gcc-git/gcc/gcc/cp/parser.cc:50534
0xd2c621 c_common_parse_file()
        /home/apinski/src/upstream-gcc-git/gcc/gcc/c-family/c-opts.cc:1278
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

```

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/111890] ICE in tsubst_friend_function with friend function declared inside a concept constrainted class inside a template class
  2023-10-20  8:02 [Bug c++/111890] New: ICE in build_new_op, friend operator in nested template specialization with constrained return type kcayimckaghxtnkrvg at cwmxc dot com
                   ` (3 preceding siblings ...)
  2023-10-22 21:30 ` [Bug c++/111890] ICE in tsubst_friend_function " pinskia at gcc dot gnu.org
@ 2023-10-23 22:38 ` sjames at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-10-23 22:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111890

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sjames at gcc dot gnu.org

--- Comment #5 from Sam James <sjames at gcc dot gnu.org> ---
10.5, tip of 11/12/13, trunk are all bad

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-10-23 22:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-20  8:02 [Bug c++/111890] New: ICE in build_new_op, friend operator in nested template specialization with constrained return type kcayimckaghxtnkrvg at cwmxc dot com
2023-10-22 19:13 ` [Bug c++/111890] " pinskia at gcc dot gnu.org
2023-10-22 20:40 ` pinskia at gcc dot gnu.org
2023-10-22 21:27 ` [Bug c++/111890] ICE in build_new_op with friend function declared inside a concept constrainted class inside a template class pinskia at gcc dot gnu.org
2023-10-22 21:30 ` [Bug c++/111890] ICE in tsubst_friend_function " pinskia at gcc dot gnu.org
2023-10-23 22:38 ` sjames 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).