public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107938] New: ICE directly returning `this` of `extern` variable in template
@ 2022-11-30 19:09 johelegp at gmail dot com
  2022-11-30 19:23 ` [Bug c++/107938] [11/12/13 Regression] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: johelegp at gmail dot com @ 2022-11-30 19:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107938
           Summary: ICE directly returning `this` of `extern` variable in
                    template
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
                CC: johelegp at gmail dot com
  Target Milestone: ---

See https://compiler-explorer.com/z/4d1esaber.

```C++
struct Q {
  int n;
  constexpr const Q* operator()(auto) const { return this; }
};

extern const Q q;

template<int>
constexpr const Q* p = q(0);
```

```
<source>:9:27: internal compiler error: Segmentation fault
    9 | constexpr const Q* p = q(0);
      |                           ^
0x22e3a9e internal_error(char const*, ...)
        ???:0
0xce2006 convert_for_initialization(tree_node*, tree_node*, tree_node*, int,
impl_conv_rhs, tree_node*, int, int)
        ???:0
0xced3f0 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ???:0
0xb22845 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ???:0
0xc20997 c_parse_file()
        ???:0
0xd5b949 c_common_parse_file()
        ???:0
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.
Compiler returned: 1
```

Being less direct works: https://compiler-explorer.com/z/jn99aG36e.

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

end of thread, other threads:[~2023-03-04 18:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-30 19:09 [Bug c++/107938] New: ICE directly returning `this` of `extern` variable in template johelegp at gmail dot com
2022-11-30 19:23 ` [Bug c++/107938] [11/12/13 Regression] " pinskia at gcc dot gnu.org
2022-11-30 19:30 ` pinskia at gcc dot gnu.org
2022-12-01  8:03 ` rguenth at gcc dot gnu.org
2022-12-02 14:52 ` [Bug c++/107938] [11/12/13 Regression] ICE directly returning `this` of `extern` variable in template since r11-557 jakub at gcc dot gnu.org
2023-02-13 18:09 ` mpolacek at gcc dot gnu.org
2023-02-23 23:52 ` mpolacek at gcc dot gnu.org
2023-02-28 15:10 ` cvs-commit at gcc dot gnu.org
2023-03-04 17:43 ` [Bug c++/107938] [11/12 " cvs-commit at gcc dot gnu.org
2023-03-04 18:24 ` 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).