[Bug c++/103921] [modules] ICE dependent expression in explicit-specifier of instantiation of imported template

2022-02-09 Thread johelegp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103921

Johel Ernesto Guerrero Peña  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|UNCONFIRMED |RESOLVED

--- Comment #5 from Johel Ernesto Guerrero Peña  ---
Resolved by https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103752#c2.

*** This bug has been marked as a duplicate of bug 103752 ***

[Bug c++/103921] [modules] ICE dependent expression in explicit-specifier of instantiation of imported template

2022-01-05 Thread johelegp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103921

--- Comment #4 from Johel Ernesto Guerrero Peña  ---
For the above, when it's fixed:
```diff
-  explicit(B) operator int() const;
+  explicit(B) operator int() { return 0; }
```

[Bug c++/103921] [modules] ICE dependent expression in explicit-specifier of instantiation of imported template

2022-01-05 Thread johelegp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103921

--- Comment #3 from Johel Ernesto Guerrero Peña  ---
Simplified: https://godbolt.org/z/rnfKrzYaP.

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

export template struct Int {
  explicit(B) operator int() const;
};
```

test.cpp:
```C++
import mod;
int main() {
  return Int{};
}
```

Output:
```
In module mod, imported at /app/test.cpp:1:
mod.cpp: In instantiation of 'struct Int@mod':
test.cpp:3:20:   required from here
mod.cpp:4:15: internal compiler error: Segmentation fault
4 |   explicit(B) operator int() 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  for instructions.
```

[Bug c++/103921] [modules] ICE dependent expression in explicit-specifier of instantiation of imported template

2022-01-05 Thread johelegp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103921

Johel Ernesto Guerrero Peña  changed:

   What|Removed |Added

Summary|[modules] ICE requires in   |[modules] ICE dependent
   |explicit-specifier of   |expression in
   |instantiation of imported   |explicit-specifier of
   |template|instantiation of imported
   ||template

--- Comment #2 from Johel Ernesto Guerrero Peña  ---
It actually ICEs whenever the expression is dependent:
https://godbolt.org/z/oqbnanoex.

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

template constexpr bool b{true};

export template struct quantity {
  template
  explicit(b) operator quantity() const;
};
```