https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97837
Bug ID: 97837
Summary: ICE on requires with *this in destructor
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gccbugbjorn at fahller dot se
Target Milestone: ---
Created attachment 49560
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49560&action=edit
Preprocessed source of failing program
The following code causes an ICE with g++-10.2.0 (also with 20201114 on
CompilerExplorer)
#include <type_traits>
template <typename>
struct S
{
~S()
requires(std::is_rvalue_reference(*this));
};
S<int> s{};
bf :-) confuciusornis /tmp> g++-10 t.cpp -std=c++20
t.cpp: In instantiation of ‘S< <template-parameter-1-1> >::~S() requires
is_rvalue_reference<...auto...>(*(S< <template-parameter-1-1> >*)this) [with
<template-parameter-1-1> = int]’:
t.cpp:10:8: required from here
t.cpp:7:40: internal compiler error: in tsubst_copy, at cp/pt.c:16383
7 | requires(std::is_rvalue_reference(*this));
| ^~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.
bf :-( confuciusornis /tmp> g++-10 --version
g++-10 (Ubuntu 10.2.0-13ubuntu1) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
bf :-) confuciusornis /tmp>
Godbolt link: https://godbolt.org/z/cbE783
The error message from "godbolt" provides more information:
<source>: In instantiation of 'S< <template-parameter-1-1> >::~S() requires
is_rvalue_reference<...auto...>(*(S< <template-parameter-1-1> >*)this) [with
<template-parameter-1-1> = int]':
<source>:10:8: required from here
<source>:7:40: internal compiler error: in tsubst_copy, at cp/pt.c:16459
7 | requires(std::is_rvalue_reference(*this));
| ^~~~
0x1bf9b89 internal_error(char const*, ...)
???:0
0x6a2dba fancy_abort(char const*, int, char const*)
???:0
0x8b0f6a tsubst_tree_list(tree_node*, tree_node*, int, tree_node*)
???:0
0x727e8a constraints_satisfied_p(tree_node*)
???:0
0x7ad23b mark_used(tree_node*, int)
???:0
0x796713 register_dtor_fn(tree_node*)
???:0
0x7b1156 c_parse_final_cleanups()
???: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.
ASM generation compiler returned: 1
<source>: In instantiation of 'S< <template-parameter-1-1> >::~S() requires
is_rvalue_reference<...auto...>(*(S< <template-parameter-1-1> >*)this) [with
<template-parameter-1-1> = int]':
<source>:10:8: required from here
<source>:7:40: internal compiler error: in tsubst_copy, at cp/pt.c:16459
7 | requires(std::is_rvalue_reference(*this));
| ^~~~
0x1bf9b89 internal_error(char const*, ...)
???:0
0x6a2dba fancy_abort(char const*, int, char const*)
???:0
0x8b0f6a tsubst_tree_list(tree_node*, tree_node*, int, tree_node*)
???:0
0x727e8a constraints_satisfied_p(tree_node*)
???:0
0x7ad23b mark_used(tree_node*, int)
???:0
0x796713 register_dtor_fn(tree_node*)
???:0
0x7b1156 c_parse_final_cleanups()
???: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.
Execution build compiler returned: 1