[Bug c++/105044] [modules] ICE in comptypes, at cp/typeck.cc:1531

johelegp at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Jul 3 21:25:23 GMT 2022


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

Johel Ernesto Guerrero Peña <johelegp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[modules] ICE in comptypes, |[modules] ICE in comptypes,
                   |at cp/typeck.c:1529         |at cp/typeck.cc:1531

--- Comment #2 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Another simpler reproducer from another use-case:
https://godbolt.org/z/jroqv6Kzq.

`mod.cpp`:
```C++
export module mod;
export template<auto> struct constant { };
export template<class> struct is_constant { };
struct monostate { };
inline constexpr constant<monostate{}> c1{};
```

`test.cpp`:
```C++
import mod;
is_constant<constant<0>> v;
int main() { }
```

Output:
```
In module mod, imported at /app/test.cpp:1:
mod.cpp: In instantiation of 'struct is_constant@mod<constant@mod<0> >':
test.cpp:2:26:   required from here
mod.cpp:3:31: internal compiler error: in comptypes, at cp/typeck.cc:1531
    3 | export template<class> struct is_constant { };
      |                               ^~~~~~~~~~~
0x2216469 internal_error(char const*, ...)
        ???:0
0x74b7d9 fancy_abort(char const*, int, char const*)
        ???:0
0xa90b66 comptypes(tree_node*, tree_node*, int)
        ???:0
0x833e5d complete_vars(tree_node*)
        ???:0
0x7ab99b finish_struct_1(tree_node*)
        ???:0
0xa13ed4 instantiate_class_template(tree_node*)
        ???:0
0x823818 start_decl_1(tree_node*, bool)
        ???:0
0x84b6a6 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ???:0
0x99555d c_parse_file()
        ???:0
0xb2bc61 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
```


More information about the Gcc-bugs mailing list