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

--- Comment #1 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Simplified: https://godbolt.org/z/zzbjj7W3K.

mod.cpp:
```C++
export module mod;

export template<class N> struct quantity {
  template<class N2>
  explicit(requires { 0; }) operator quantity<N2>() const;
};
```

test.cpp:
```C++
import mod;
int main() {
  return requires { (quantity<double>)quantity<int>{}; };
}
```

Output:
```
In module mod, imported at /app/test.cpp:1:
mod.cpp: In instantiation of 'struct quantity@mod<int>':
test.cpp:3:53:   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.
```

Reply via email to