public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97883] New: [C++20] Segmentation fault on template<auto> with braced initializer list A<{}>
@ 2020-11-18  2:41 arthur.j.odwyer at gmail dot com
  2020-11-19 18:17 ` [Bug c++/97883] " mpolacek at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: arthur.j.odwyer at gmail dot com @ 2020-11-18  2:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97883
           Summary: [C++20] Segmentation fault on template<auto> with
                    braced initializer list A<{}>
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arthur.j.odwyer at gmail dot com
  Target Milestone: ---

// https://godbolt.org/z/841ahx
template<auto> struct A;
A<{}> a;

In -std=c++17 mode, this gives an error as expected. In -std=c++20 mode, this
segfaults:

<source>:2:5: error: deducing from brace-enclosed initializer list requires
'#include <initializer_list>'
  +++ |+#include <initializer_list>
    1 | template<auto> struct A;
    2 | A<{}> a;
      |     ^
<source>:2:5: internal compiler error: Segmentation fault
0x1bf9b89 internal_error(char const*, ...)
        ???:0
0x8a5846 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
        ???:0
0x8c48ac lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ???:0
0x9197cd finish_template_type(tree_node*, tree_node*, int)
        ???:0
0x87f57c c_parse_file()
        ???:0
0x9f7452 c_common_parse_file()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


If you "#include <initializer_list>", you successfully suppress the first error
message; but the segfault still happens in the same place.

Might be related to #95291 or #97749. It's weird that this happens ONLY in
C++20 mode, even though it uses nothing but C++17 features.

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

* [Bug c++/97883] [C++20] Segmentation fault on template<auto> with braced initializer list A<{}>
  2020-11-18  2:41 [Bug c++/97883] New: [C++20] Segmentation fault on template<auto> with braced initializer list A<{}> arthur.j.odwyer at gmail dot com
@ 2020-11-19 18:17 ` mpolacek at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-11-19 18:17 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
                 CC|                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This is actually PR97895 for which I already posted a patch and should be fixed
before long.

*** This bug has been marked as a duplicate of bug 97895 ***

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

end of thread, other threads:[~2020-11-19 18:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18  2:41 [Bug c++/97883] New: [C++20] Segmentation fault on template<auto> with braced initializer list A<{}> arthur.j.odwyer at gmail dot com
2020-11-19 18:17 ` [Bug c++/97883] " mpolacek 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).