https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103921
Bug ID: 103921
Summary: [modules] ICE requires in explicit-specifier of
instantiation of imported template
Product: gcc
Version: 12.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://godbolt.org/z/Tb1eMbE3W.
I think it's valid because Clang accepts it: https://godbolt.org/z/xcK7Kenb5.
mod.cpp:
```C++
export module mod;
export template<class N> struct quantity {
template<class N2>
explicit(requires { 0; }) operator quantity<N2>() const;
};
export template<class N1, class N2>
bool operator==(const quantity<N1>& l, const quantity<N2>& r);
```
test.cpp:
```C++
import mod;
int main() {
return requires { quantity<int>{} == quantity<double>{}; };
}
```
Output:
```
In module mod, imported at /app/test.cpp:1:
mod.cpp: In instantiation of 'struct quantity@mod<int>':
test.cpp:3:35: required from here
mod.cpp:5:29: internal compiler error: Segmentation fault
5 | explicit(requires { 0; }) operator quantity<N2>() const;
| ^~~~~~~~
0x2139bd9 internal_error(char const*, ...)
???:0
0x9ada27 tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x9f2c99 instantiate_class_template(tree_node*)
???:0
0xa184bc finish_compound_literal(tree_node*, tree_node*, int, fcl_t)
???:0
0x97a00d c_parse_file()
???:0
0xb08022 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.
```