public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103921] New: [modules] ICE requires in explicit-specifier of instantiation of imported template
@ 2022-01-05 16:52 johelegp at gmail dot com
2022-01-05 17:01 ` [Bug c++/103921] " johelegp at gmail dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: johelegp at gmail dot com @ 2022-01-05 16:52 UTC (permalink / raw)
To: gcc-bugs
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.
```
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/103921] [modules] ICE requires in explicit-specifier of instantiation of imported template
2022-01-05 16:52 [Bug c++/103921] New: [modules] ICE requires in explicit-specifier of instantiation of imported template johelegp at gmail dot com
@ 2022-01-05 17:01 ` johelegp at gmail dot com
2022-01-05 18:15 ` [Bug c++/103921] [modules] ICE dependent expression " johelegp at gmail dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: johelegp at gmail dot com @ 2022-01-05 17:01 UTC (permalink / raw)
To: gcc-bugs
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.
```
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/103921] [modules] ICE dependent expression in explicit-specifier of instantiation of imported template
2022-01-05 16:52 [Bug c++/103921] New: [modules] ICE requires in explicit-specifier of instantiation of imported template johelegp at gmail dot com
2022-01-05 17:01 ` [Bug c++/103921] " johelegp at gmail dot com
@ 2022-01-05 18:15 ` johelegp at gmail dot com
2022-01-05 18:25 ` johelegp at gmail dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: johelegp at gmail dot com @ 2022-01-05 18:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103921
Johel Ernesto Guerrero Peña <johelegp at gmail dot com> 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 <johelegp at gmail dot com> ---
It actually ICEs whenever the expression is dependent:
https://godbolt.org/z/oqbnanoex.
mod.cpp:
```C++
export module mod;
template<class> constexpr bool b{true};
export template<class N> struct quantity {
template<class N2>
explicit(b<N>) operator quantity<N2>() const;
};
```
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/103921] [modules] ICE dependent expression in explicit-specifier of instantiation of imported template
2022-01-05 16:52 [Bug c++/103921] New: [modules] ICE requires in explicit-specifier of instantiation of imported template johelegp at gmail dot com
2022-01-05 17:01 ` [Bug c++/103921] " johelegp at gmail dot com
2022-01-05 18:15 ` [Bug c++/103921] [modules] ICE dependent expression " johelegp at gmail dot com
@ 2022-01-05 18:25 ` johelegp at gmail dot com
2022-01-05 18:27 ` johelegp at gmail dot com
2022-02-09 16:32 ` johelegp at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: johelegp at gmail dot com @ 2022-01-05 18:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103921
--- Comment #3 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Simplified: https://godbolt.org/z/rnfKrzYaP.
mod.cpp:
```C++
export module mod;
export template<bool B> struct Int {
explicit(B) operator int() const;
};
```
test.cpp:
```C++
import mod;
int main() {
return Int<true>{};
}
```
Output:
```
In module mod, imported at /app/test.cpp:1:
mod.cpp: In instantiation of 'struct Int@mod<true>':
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 <https://gcc.gnu.org/bugs/> for instructions.
```
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/103921] [modules] ICE dependent expression in explicit-specifier of instantiation of imported template
2022-01-05 16:52 [Bug c++/103921] New: [modules] ICE requires in explicit-specifier of instantiation of imported template johelegp at gmail dot com
` (2 preceding siblings ...)
2022-01-05 18:25 ` johelegp at gmail dot com
@ 2022-01-05 18:27 ` johelegp at gmail dot com
2022-02-09 16:32 ` johelegp at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: johelegp at gmail dot com @ 2022-01-05 18:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103921
--- Comment #4 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
For the above, when it's fixed:
```diff
- explicit(B) operator int() const;
+ explicit(B) operator int() { return 0; }
```
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/103921] [modules] ICE dependent expression in explicit-specifier of instantiation of imported template
2022-01-05 16:52 [Bug c++/103921] New: [modules] ICE requires in explicit-specifier of instantiation of imported template johelegp at gmail dot com
` (3 preceding siblings ...)
2022-01-05 18:27 ` johelegp at gmail dot com
@ 2022-02-09 16:32 ` johelegp at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: johelegp at gmail dot com @ 2022-02-09 16:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103921
Johel Ernesto Guerrero Peña <johelegp at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
--- Comment #5 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Resolved by https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103752#c2.
*** This bug has been marked as a duplicate of bug 103752 ***
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-02-09 16:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 16:52 [Bug c++/103921] New: [modules] ICE requires in explicit-specifier of instantiation of imported template johelegp at gmail dot com
2022-01-05 17:01 ` [Bug c++/103921] " johelegp at gmail dot com
2022-01-05 18:15 ` [Bug c++/103921] [modules] ICE dependent expression " johelegp at gmail dot com
2022-01-05 18:25 ` johelegp at gmail dot com
2022-01-05 18:27 ` johelegp at gmail dot com
2022-02-09 16:32 ` johelegp at gmail dot com
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).