public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105044] New: [modules] ICE in comptypes, at cp/typeck.c:1529
@ 2022-03-24 10:53 johelegp at gmail dot com
  2022-07-03 21:24 ` [Bug c++/105044] " johelegp at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: johelegp at gmail dot com @ 2022-03-24 10:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105044
           Summary: [modules] ICE in comptypes, at cp/typeck.c:1529
           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
  Target Milestone: ---

See https://godbolt.org/z/YGo78aPE8.

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

export template<typename BaseType>
struct downcast_base {
  using downcast_base_type = BaseType;
  friend auto downcast_guide(downcast_base);
};

export template<typename T> concept Downcastable = true;

export template<typename Target, Downcastable T>
struct downcast_child : T {
  friend auto downcast_guide(typename T::downcast_base) { return T(); }
};

export struct ratio { int num; };

export template<ratio R, typename U>
struct scaled_unit : downcast_base<scaled_unit<R, U>> {};

export template<typename Child>
struct unit : downcast_child<Child, scaled_unit<ratio(1), Child>> {};

export struct unknown_coherent_unit : unit<unknown_coherent_unit> {};
```

`test.cpp`:
```C++
import mod;
struct u : downcast_base<u> { };
int main() { }
```

Output:
```
In module mod, imported at /app/test.cpp:1:
mod.cpp: In instantiation of 'struct downcast_base@mod<u>':
test.cpp:2:12:   required from here
mod.cpp:4:8: internal compiler error: in comptypes, at cp/typeck.cc:1529
    4 | struct downcast_base {
      |        ^~~~~~~~~~~~~
0x218c519 internal_error(char const*, ...)
        ???:0
0x741b3f fancy_abort(char const*, int, char const*)
        ???:0
0xa7e346 comptypes(tree_node*, tree_node*, int)
        ???:0
0x828f6d complete_vars(tree_node*)
        ???:0
0x7a1a5c finish_struct_1(tree_node*)
        ???:0
0xa01359 instantiate_class_template(tree_node*)
        ???:0
0xa7739b complete_type_or_maybe_complain(tree_node*, tree_node*, int)
        ???:0
0x841a1c xref_basetypes(tree_node*, tree_node*)
        ???:0
0x986b0d c_parse_file()
        ???:0
0xb18ae2 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.
```

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-18 15:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-24 10:53 [Bug c++/105044] New: [modules] ICE in comptypes, at cp/typeck.c:1529 johelegp at gmail dot com
2022-07-03 21:24 ` [Bug c++/105044] " johelegp at gmail dot com
2022-07-03 21:25 ` [Bug c++/105044] [modules] ICE in comptypes, at cp/typeck.cc:1531 johelegp at gmail dot com
2022-07-04  3:28 ` johelegp at gmail dot com
2022-10-18 15:10 ` ppalka at gcc dot gnu.org

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).