public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98990] New: Internal compiler error when two overloaded functions return `auto &&` and one accepts an `auto` parameter
@ 2021-02-07 22:35 david at doublewise dot net
  2021-02-07 22:37 ` [Bug c++/98990] " david at doublewise dot net
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: david at doublewise dot net @ 2021-02-07 22:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98990
           Summary: Internal compiler error when two overloaded functions
                    return `auto &&` and one accepts an `auto` parameter
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david at doublewise dot net
  Target Milestone: ---

The following valid translation unit

```
constexpr int x = 0;

constexpr auto && f() {
        return x;
}
constexpr auto && f(auto) {
        return x;
}
```

causes gcc to crash with

```
<source>:6:25: internal compiler error: same canonical type node for different
types 'auto&&' and 'auto&&'
    6 | constexpr auto && f(auto) {
      |                         ^
0x1ce6f09 internal_error(char const*, ...)
        ???:0
0x9c60ce comptypes(tree_node*, tree_node*, int)
        ???:0
0x78ef77 decls_match(tree_node*, tree_node*, bool)
        ???:0
0x7c003c cplus_decl_attributes(tree_node**, tree_node*, int)
        ???:0
0x79f277 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        ???:0
0x7a3916 start_function(cp_decl_specifier_seq*, cp_declarator const*,
tree_node*)
        ???:0
0x8de23d c_parse_file()
        ???:0
0xa5b7c2 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.
Compiler returned: 1
```

See it live: https://godbolt.org/z/bnszYo

This code was accepted in gcc 10.2, but it is rejected by the upcoming 11.0.

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

end of thread, other threads:[~2021-03-31 12:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-07 22:35 [Bug c++/98990] New: Internal compiler error when two overloaded functions return `auto &&` and one accepts an `auto` parameter david at doublewise dot net
2021-02-07 22:37 ` [Bug c++/98990] " david at doublewise dot net
2021-02-08  9:04 ` [Bug c++/98990] [10/11 Regression] ICE when two overloaded functions return `auto &&` and one accepts an `auto` parameter since r10-6571-ga6ee556c7659877b marxin at gcc dot gnu.org
2021-02-08  9:22 ` rguenth at gcc dot gnu.org
2021-02-08 21:00 ` jason at gcc dot gnu.org
2021-02-08 21:11 ` jason at gcc dot gnu.org
2021-02-08 21:22 ` ppalka at gcc dot gnu.org
2021-02-26  0:57 ` cvs-commit at gcc dot gnu.org
2021-02-26  0:58 ` [Bug c++/98990] [10 " ppalka at gcc dot gnu.org
2021-03-31 12:33 ` cvs-commit at gcc dot gnu.org
2021-03-31 12:34 ` 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).